| OLD | NEW |
| 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 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 return 0; | 1542 return 0; |
| 1543 } | 1543 } |
| 1544 return TreeWalker::create(root, whatToShow, filter); | 1544 return TreeWalker::create(root, whatToShow, filter); |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 bool Document::shouldCallRecalcStyleForDocument() | 1547 bool Document::shouldCallRecalcStyleForDocument() |
| 1548 { | 1548 { |
| 1549 return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi
onRecalc() || !m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidati
on(); | 1549 return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributi
onRecalc() || !m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidati
on(); |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 bool Document::shouldScheduleStyleRecalc() |
| 1553 { |
| 1554 if (!isActive()) |
| 1555 return false; |
| 1556 if (hasPendingStyleRecalc()) |
| 1557 return false; |
| 1558 if (inStyleRecalc()) |
| 1559 return false; |
| 1560 // InPreLayout will recalc style itself. There's no reason to schedule anoth
er recalc. |
| 1561 if (m_lifecycle.state() == DocumentLifecycle::InPreLayout) |
| 1562 return false; |
| 1563 if (!shouldScheduleLayout()) |
| 1564 return false; |
| 1565 return true; |
| 1566 } |
| 1567 |
| 1552 void Document::scheduleStyleRecalc() | 1568 void Document::scheduleStyleRecalc() |
| 1553 { | 1569 { |
| 1554 if (hasPendingStyleRecalc() || !isActive() || inStyleRecalc() || !shouldSche
duleLayout()) | 1570 if (!shouldScheduleStyleRecalc()) |
| 1555 return; | 1571 return; |
| 1556 | 1572 |
| 1557 ASSERT(shouldCallRecalcStyleForDocument()); | 1573 ASSERT(shouldCallRecalcStyleForDocument()); |
| 1558 | 1574 |
| 1559 view()->scheduleAnimation(); | 1575 view()->scheduleAnimation(); |
| 1560 m_lifecycle.rewindTo(DocumentLifecycle::StyleRecalcPending); | 1576 m_lifecycle.advanceTo(DocumentLifecycle::StyleRecalcPending); |
| 1561 | 1577 |
| 1562 InspectorInstrumentation::didScheduleStyleRecalculation(this); | 1578 InspectorInstrumentation::didScheduleStyleRecalculation(this); |
| 1563 } | 1579 } |
| 1564 | 1580 |
| 1565 bool Document::hasPendingForcedStyleRecalc() const | 1581 bool Document::hasPendingForcedStyleRecalc() const |
| 1566 { | 1582 { |
| 1567 return hasPendingStyleRecalc() && !inStyleRecalc() && styleChangeType() >= S
ubtreeStyleChange; | 1583 return hasPendingStyleRecalc() && !inStyleRecalc() && styleChangeType() >= S
ubtreeStyleChange; |
| 1568 } | 1584 } |
| 1569 | 1585 |
| 1570 void Document::updateDistributionIfNeeded() | 1586 void Document::updateDistributionIfNeeded() |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 if (m_styleEngine->hasResolver()) { | 1778 if (m_styleEngine->hasResolver()) { |
| 1763 // Pseudo element removal and similar may only work with these flags
still set. Reset them after the style recalc. | 1779 // Pseudo element removal and similar may only work with these flags
still set. Reset them after the style recalc. |
| 1764 StyleResolver& resolver = m_styleEngine->ensureResolver(); | 1780 StyleResolver& resolver = m_styleEngine->ensureResolver(); |
| 1765 m_styleEngine->resetCSSFeatureFlags(resolver.ensureRuleFeatureSet())
; | 1781 m_styleEngine->resetCSSFeatureFlags(resolver.ensureRuleFeatureSet())
; |
| 1766 resolver.clearStyleSharingList(); | 1782 resolver.clearStyleSharingList(); |
| 1767 } | 1783 } |
| 1768 | 1784 |
| 1769 ASSERT(!needsStyleRecalc()); | 1785 ASSERT(!needsStyleRecalc()); |
| 1770 ASSERT(!childNeedsStyleRecalc()); | 1786 ASSERT(!childNeedsStyleRecalc()); |
| 1771 ASSERT(inStyleRecalc()); | 1787 ASSERT(inStyleRecalc()); |
| 1772 m_lifecycle.advanceTo(DocumentLifecycle::Clean); | 1788 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 1773 } | 1789 } |
| 1774 | 1790 |
| 1775 InspectorInstrumentation::didRecalculateStyle(cookie); | 1791 InspectorInstrumentation::didRecalculateStyle(cookie); |
| 1776 | 1792 |
| 1777 // As a result of the style recalculation, the currently hovered element mig
ht have been | 1793 // As a result of the style recalculation, the currently hovered element mig
ht have been |
| 1778 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event | 1794 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event |
| 1779 // to check if any other elements ended up under the mouse pointer due to re
-layout. | 1795 // to check if any other elements ended up under the mouse pointer due to re
-layout. |
| 1780 if (hoverNode() && !hoverNode()->renderer() && frame()) | 1796 if (hoverNode() && !hoverNode()->renderer() && frame()) |
| 1781 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); | 1797 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); |
| 1782 | 1798 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 | 2058 |
| 2043 m_renderView = new RenderView(this); | 2059 m_renderView = new RenderView(this); |
| 2044 setRenderer(m_renderView); | 2060 setRenderer(m_renderView); |
| 2045 | 2061 |
| 2046 m_renderView->setIsInWindow(true); | 2062 m_renderView->setIsInWindow(true); |
| 2047 m_renderView->setStyle(StyleResolver::styleForDocument(*this)); | 2063 m_renderView->setStyle(StyleResolver::styleForDocument(*this)); |
| 2048 view()->updateCompositingLayersAfterStyleChange(); | 2064 view()->updateCompositingLayersAfterStyleChange(); |
| 2049 | 2065 |
| 2050 ContainerNode::attach(context); | 2066 ContainerNode::attach(context); |
| 2051 | 2067 |
| 2052 m_lifecycle.advanceTo(DocumentLifecycle::Clean); | 2068 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 2053 } | 2069 } |
| 2054 | 2070 |
| 2055 void Document::detach(const AttachContext& context) | 2071 void Document::detach(const AttachContext& context) |
| 2056 { | 2072 { |
| 2057 ASSERT(isActive()); | 2073 ASSERT(isActive()); |
| 2058 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); | 2074 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); |
| 2059 | 2075 |
| 2060 if (page()) | 2076 if (page()) |
| 2061 page()->documentDetached(this); | 2077 page()->documentDetached(this); |
| 2062 | 2078 |
| (...skipping 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5398 void Document::defaultEventHandler(Event* event) | 5414 void Document::defaultEventHandler(Event* event) |
| 5399 { | 5415 { |
| 5400 if (frame() && frame()->remotePlatformLayer()) { | 5416 if (frame() && frame()->remotePlatformLayer()) { |
| 5401 frame()->chromeClient().forwardInputEvent(this, event); | 5417 frame()->chromeClient().forwardInputEvent(this, event); |
| 5402 return; | 5418 return; |
| 5403 } | 5419 } |
| 5404 Node::defaultEventHandler(event); | 5420 Node::defaultEventHandler(event); |
| 5405 } | 5421 } |
| 5406 | 5422 |
| 5407 } // namespace WebCore | 5423 } // namespace WebCore |
| OLD | NEW |