| 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 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. | 2003 // FIXME: We are willing to attempt to suppress painting with outdated s
tyle info only once. |
| 2004 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page | 2004 // Our assumption is that it would be dangerous to try to stop it a seco
nd time, after page |
| 2005 // content has already been loaded and displayed with accurate style inf
ormation. (Our | 2005 // content has already been loaded and displayed with accurate style inf
ormation. (Our |
| 2006 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we | 2006 // suppression involves blanking the whole page at the moment. If it wer
e more refined, we |
| 2007 // might be able to do something better.) It's worth noting though that
this entire method | 2007 // might be able to do something better.) It's worth noting though that
this entire method |
| 2008 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with | 2008 // is a hack, since what we really want to do is suspend JS instead of d
oing a layout with |
| 2009 // inaccurate information. | 2009 // inaccurate information. |
| 2010 HTMLElement* bodyElement = body(); | 2010 HTMLElement* bodyElement = body(); |
| 2011 if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == N
oLayoutWithPendingSheets) { | 2011 if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == N
oLayoutWithPendingSheets) { |
| 2012 m_pendingSheetLayout = DidLayoutWithPendingSheets; | 2012 m_pendingSheetLayout = DidLayoutWithPendingSheets; |
| 2013 styleResolverChanged(RecalcStyleDeferred); | 2013 styleResolverChanged(); |
| 2014 } else if (m_hasNodesWithPlaceholderStyle) { | 2014 } else if (m_hasNodesWithPlaceholderStyle) { |
| 2015 // If new nodes have been added or style recalc has been done with s
tyle sheets still | 2015 // If new nodes have been added or style recalc has been done with s
tyle sheets still |
| 2016 // pending, some nodes may not have had their real style calculated
yet. Normally this | 2016 // pending, some nodes may not have had their real style calculated
yet. Normally this |
| 2017 // gets cleaned when style sheets arrive but here we need up-to-date
style immediately. | 2017 // gets cleaned when style sheets arrive but here we need up-to-date
style immediately. |
| 2018 updateRenderTree(Force); | 2018 updateRenderTree(Force); |
| 2019 } | 2019 } |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 updateLayout(); | 2022 updateLayout(); |
| 2023 | 2023 |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 void Document::processHttpEquivDefaultStyle(const AtomicString& content) | 3072 void Document::processHttpEquivDefaultStyle(const AtomicString& content) |
| 3073 { | 3073 { |
| 3074 // The preferred style set has been overridden as per section | 3074 // The preferred style set has been overridden as per section |
| 3075 // 14.3.2 of the HTML4.0 specification. We need to update the | 3075 // 14.3.2 of the HTML4.0 specification. We need to update the |
| 3076 // sheet used variable and then update our style selector. | 3076 // sheet used variable and then update our style selector. |
| 3077 // For more info, see the test at: | 3077 // For more info, see the test at: |
| 3078 // http://www.hixie.ch/tests/evil/css/import/main/preferred.html | 3078 // http://www.hixie.ch/tests/evil/css/import/main/preferred.html |
| 3079 // -dwh | 3079 // -dwh |
| 3080 m_styleEngine->setSelectedStylesheetSetName(content); | 3080 m_styleEngine->setSelectedStylesheetSetName(content); |
| 3081 m_styleEngine->setPreferredStylesheetSetName(content); | 3081 m_styleEngine->setPreferredStylesheetSetName(content); |
| 3082 styleResolverChanged(RecalcStyleDeferred); | 3082 styleResolverChanged(); |
| 3083 } | 3083 } |
| 3084 | 3084 |
| 3085 void Document::processHttpEquivRefresh(const AtomicString& content) | 3085 void Document::processHttpEquivRefresh(const AtomicString& content) |
| 3086 { | 3086 { |
| 3087 maybeHandleHttpRefresh(content, HttpRefreshFromMetaTag); | 3087 maybeHandleHttpRefresh(content, HttpRefreshFromMetaTag); |
| 3088 } | 3088 } |
| 3089 | 3089 |
| 3090 void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType htt
pRefreshType) | 3090 void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType htt
pRefreshType) |
| 3091 { | 3091 { |
| 3092 if (m_isViewSource || !m_frame) | 3092 if (m_isViewSource || !m_frame) |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3400 } | 3400 } |
| 3401 | 3401 |
| 3402 String Document::selectedStylesheetSet() const | 3402 String Document::selectedStylesheetSet() const |
| 3403 { | 3403 { |
| 3404 return m_styleEngine->selectedStylesheetSetName(); | 3404 return m_styleEngine->selectedStylesheetSetName(); |
| 3405 } | 3405 } |
| 3406 | 3406 |
| 3407 void Document::setSelectedStylesheetSet(const String& aString) | 3407 void Document::setSelectedStylesheetSet(const String& aString) |
| 3408 { | 3408 { |
| 3409 m_styleEngine->setSelectedStylesheetSetName(aString); | 3409 m_styleEngine->setSelectedStylesheetSetName(aString); |
| 3410 styleResolverChanged(RecalcStyleDeferred); | 3410 styleResolverChanged(); |
| 3411 } | 3411 } |
| 3412 | 3412 |
| 3413 void Document::evaluateMediaQueryListIfNeeded() | 3413 void Document::evaluateMediaQueryListIfNeeded() |
| 3414 { | 3414 { |
| 3415 if (!m_evaluateMediaQueriesOnStyleRecalc) | 3415 if (!m_evaluateMediaQueriesOnStyleRecalc) |
| 3416 return; | 3416 return; |
| 3417 evaluateMediaQueryList(); | 3417 evaluateMediaQueryList(); |
| 3418 m_evaluateMediaQueriesOnStyleRecalc = false; | 3418 m_evaluateMediaQueriesOnStyleRecalc = false; |
| 3419 } | 3419 } |
| 3420 | 3420 |
| 3421 void Document::evaluateMediaQueryList() | 3421 void Document::evaluateMediaQueryList() |
| 3422 { | 3422 { |
| 3423 if (m_mediaQueryMatcher) | 3423 if (m_mediaQueryMatcher) |
| 3424 m_mediaQueryMatcher->styleResolverChanged(); | 3424 m_mediaQueryMatcher->styleResolverChanged(); |
| 3425 } | 3425 } |
| 3426 | 3426 |
| 3427 void Document::notifyResizeForViewportUnits() | 3427 void Document::notifyResizeForViewportUnits() |
| 3428 { | 3428 { |
| 3429 if (!hasViewportUnits()) | 3429 if (!hasViewportUnits()) |
| 3430 return; | 3430 return; |
| 3431 ensureStyleResolver().notifyResizeForViewportUnits(); | 3431 ensureStyleResolver().notifyResizeForViewportUnits(); |
| 3432 setNeedsStyleRecalcForViewportUnits(); | 3432 setNeedsStyleRecalcForViewportUnits(); |
| 3433 } | 3433 } |
| 3434 | 3434 |
| 3435 void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpd
ateMode updateMode) | 3435 void Document::styleResolverChanged(StyleResolverUpdateMode updateMode) |
| 3436 { | 3436 { |
| 3437 // styleResolverChanged() can be invoked during Document destruction. | 3437 // styleResolverChanged() can be invoked during Document destruction. |
| 3438 // We just skip that case. | 3438 // We just skip that case. |
| 3439 if (!m_styleEngine) | 3439 if (!m_styleEngine) |
| 3440 return; | 3440 return; |
| 3441 | 3441 |
| 3442 StyleResolverChange change = m_styleEngine->resolverChanged(updateTime, upda
teMode); | 3442 StyleResolverChange change = m_styleEngine->resolverChanged(updateMode); |
| 3443 if (change.needsRepaint()) { | 3443 if (change.needsRepaint()) { |
| 3444 // We need to manually repaint because we avoid doing all repaints in la
yout or style | 3444 // We need to manually repaint because we avoid doing all repaints in la
yout or style |
| 3445 // recalc while sheets are still loading to avoid FOUC. | 3445 // recalc while sheets are still loading to avoid FOUC. |
| 3446 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; | 3446 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; |
| 3447 renderView()->repaintViewAndCompositedLayers(); | 3447 renderView()->repaintViewAndCompositedLayers(); |
| 3448 } | 3448 } |
| 3449 | 3449 |
| 3450 if (!change.needsStyleRecalc()) | 3450 if (!change.needsStyleRecalc()) |
| 3451 return; | 3451 return; |
| 3452 | 3452 |
| 3453 m_evaluateMediaQueriesOnStyleRecalc = true; | 3453 m_evaluateMediaQueriesOnStyleRecalc = true; |
| 3454 setNeedsStyleRecalc(SubtreeStyleChange); | 3454 setNeedsStyleRecalc(SubtreeStyleChange); |
| 3455 | |
| 3456 if (updateTime == RecalcStyleImmediately) | |
| 3457 updateRenderTreeIfNeeded(); | |
| 3458 } | 3455 } |
| 3459 | 3456 |
| 3460 void Document::styleResolverMayHaveChanged() | 3457 void Document::styleResolverMayHaveChanged() |
| 3461 { | 3458 { |
| 3462 styleResolverChanged(RecalcStyleDeferred, hasNodesWithPlaceholderStyle() ? F
ullStyleUpdate : AnalyzedStyleUpdate); | 3459 styleResolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : Anal
yzedStyleUpdate); |
| 3463 } | 3460 } |
| 3464 | 3461 |
| 3465 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) | 3462 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) |
| 3466 { | 3463 { |
| 3467 m_hoverNode = newHoverNode; | 3464 m_hoverNode = newHoverNode; |
| 3468 } | 3465 } |
| 3469 | 3466 |
| 3470 void Document::setActiveHoverElement(PassRefPtr<Element> newActiveElement) | 3467 void Document::setActiveHoverElement(PassRefPtr<Element> newActiveElement) |
| 3471 { | 3468 { |
| 3472 if (!newActiveElement) { | 3469 if (!newActiveElement) { |
| (...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5593 PassOwnPtr<LifecycleNotifier<Document> > Document::createLifecycleNotifier() | 5590 PassOwnPtr<LifecycleNotifier<Document> > Document::createLifecycleNotifier() |
| 5594 { | 5591 { |
| 5595 return DocumentLifecycleNotifier::create(this); | 5592 return DocumentLifecycleNotifier::create(this); |
| 5596 } | 5593 } |
| 5597 | 5594 |
| 5598 DocumentLifecycleNotifier& Document::lifecycleNotifier() | 5595 DocumentLifecycleNotifier& Document::lifecycleNotifier() |
| 5599 { | 5596 { |
| 5600 return static_cast<DocumentLifecycleNotifier&>(LifecycleContext<Document>::l
ifecycleNotifier()); | 5597 return static_cast<DocumentLifecycleNotifier&>(LifecycleContext<Document>::l
ifecycleNotifier()); |
| 5601 } | 5598 } |
| 5602 | 5599 |
| 5603 void Document::removedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, StyleR
esolverUpdateMode updateMode) | 5600 void Document::removedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upda
teMode) |
| 5604 { | 5601 { |
| 5605 // If we're in document teardown, then we don't need this notification of ou
r sheet's removal. | 5602 // If we're in document teardown, then we don't need this notification of ou
r sheet's removal. |
| 5606 // styleResolverChanged() is needed even when the document is inactive so th
at | 5603 // styleResolverChanged() is needed even when the document is inactive so th
at |
| 5607 // imported docuements (which is inactive) notifies the change to the master
document. | 5604 // imported docuements (which is inactive) notifies the change to the master
document. |
| 5608 if (isActive()) | 5605 if (isActive()) |
| 5609 styleEngine()->modifiedStyleSheet(sheet); | 5606 styleEngine()->modifiedStyleSheet(sheet); |
| 5610 styleResolverChanged(when, updateMode); | 5607 styleResolverChanged(updateMode); |
| 5611 } | 5608 } |
| 5612 | 5609 |
| 5613 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) | 5610 void Document::modifiedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upd
ateMode) |
| 5614 { | 5611 { |
| 5615 // If we're in document teardown, then we don't need this notification of ou
r sheet's removal. | 5612 // If we're in document teardown, then we don't need this notification of ou
r sheet's removal. |
| 5616 // styleResolverChanged() is needed even when the document is inactive so th
at | 5613 // styleResolverChanged() is needed even when the document is inactive so th
at |
| 5617 // imported docuements (which is inactive) notifies the change to the master
document. | 5614 // imported docuements (which is inactive) notifies the change to the master
document. |
| 5618 if (isActive()) | 5615 if (isActive()) |
| 5619 styleEngine()->modifiedStyleSheet(sheet); | 5616 styleEngine()->modifiedStyleSheet(sheet); |
| 5620 styleResolverChanged(when, updateMode); | 5617 styleResolverChanged(updateMode); |
| 5621 } | 5618 } |
| 5622 | 5619 |
| 5623 TextAutosizer* Document::textAutosizer() | 5620 TextAutosizer* Document::textAutosizer() |
| 5624 { | 5621 { |
| 5625 if (!m_textAutosizer && !RuntimeEnabledFeatures::fastTextAutosizingEnabled()
) | 5622 if (!m_textAutosizer && !RuntimeEnabledFeatures::fastTextAutosizingEnabled()
) |
| 5626 m_textAutosizer = TextAutosizer::create(this); | 5623 m_textAutosizer = TextAutosizer::create(this); |
| 5627 return m_textAutosizer.get(); | 5624 return m_textAutosizer.get(); |
| 5628 } | 5625 } |
| 5629 | 5626 |
| 5630 FastTextAutosizer* Document::fastTextAutosizer() | 5627 FastTextAutosizer* Document::fastTextAutosizer() |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5760 visitor->trace(m_timeline); | 5757 visitor->trace(m_timeline); |
| 5761 visitor->trace(m_compositorPendingAnimations); | 5758 visitor->trace(m_compositorPendingAnimations); |
| 5762 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); | 5759 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); |
| 5763 DocumentSupplementable::trace(visitor); | 5760 DocumentSupplementable::trace(visitor); |
| 5764 TreeScope::trace(visitor); | 5761 TreeScope::trace(visitor); |
| 5765 ContainerNode::trace(visitor); | 5762 ContainerNode::trace(visitor); |
| 5766 ExecutionContext::trace(visitor); | 5763 ExecutionContext::trace(visitor); |
| 5767 } | 5764 } |
| 5768 | 5765 |
| 5769 } // namespace WebCore | 5766 } // namespace WebCore |
| OLD | NEW |