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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 setEncodingData(newEncodingData); | 1179 setEncodingData(newEncodingData); |
1180 } | 1180 } |
1181 | 1181 |
1182 void Document::setContentLanguage(const AtomicString& language) | 1182 void Document::setContentLanguage(const AtomicString& language) |
1183 { | 1183 { |
1184 if (m_contentLanguage == language) | 1184 if (m_contentLanguage == language) |
1185 return; | 1185 return; |
1186 m_contentLanguage = language; | 1186 m_contentLanguage = language; |
1187 | 1187 |
1188 // Document's style depends on the content language. | 1188 // Document's style depends on the content language. |
1189 setNeedsStyleRecalc(); | 1189 setNeedsStyleRecalc(SubtreeStyleChange); |
1190 } | 1190 } |
1191 | 1191 |
1192 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta
te) | 1192 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta
te) |
1193 { | 1193 { |
1194 if (!implementation()->hasFeature("XML", String())) { | 1194 if (!implementation()->hasFeature("XML", String())) { |
1195 exceptionState.throwDOMException(NotSupportedError, "This document does
not support XML."); | 1195 exceptionState.throwDOMException(NotSupportedError, "This document does
not support XML."); |
1196 return; | 1196 return; |
1197 } | 1197 } |
1198 | 1198 |
1199 if (!XMLDocumentParser::supportsXMLVersion(version)) { | 1199 if (!XMLDocumentParser::supportsXMLVersion(version)) { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 | 1675 |
1676 // Resolved rem units are stored in the matched properties cache so we need
to make sure to | 1676 // Resolved rem units are stored in the matched properties cache so we need
to make sure to |
1677 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed | 1677 // invalidate the cache if the documentElement needed to reattach or the fon
t size changed |
1678 // and then trigger a full document recalc. We also need to clear it here si
nce the | 1678 // and then trigger a full document recalc. We also need to clear it here si
nce the |
1679 // call to styleForElement on the body above can cache bad values for rem un
its if the | 1679 // call to styleForElement on the body above can cache bad values for rem un
its if the |
1680 // documentElement's style was dirty. We could keep track of which elements
depend on | 1680 // documentElement's style was dirty. We could keep track of which elements
depend on |
1681 // rem units like we do for viewport styles, but we assume root font size ch
anges are | 1681 // rem units like we do for viewport styles, but we assume root font size ch
anges are |
1682 // rare and just invalidate the cache for now. | 1682 // rare and just invalidate the cache for now. |
1683 if (styleEngine()->usesRemUnits() && (documentElement()->needsAttach() || do
cumentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize()
)) { | 1683 if (styleEngine()->usesRemUnits() && (documentElement()->needsAttach() || do
cumentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize()
)) { |
1684 ensureStyleResolver().invalidateMatchedPropertiesCache(); | 1684 ensureStyleResolver().invalidateMatchedPropertiesCache(); |
1685 documentElement()->setNeedsStyleRecalc(); | 1685 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); |
1686 } | 1686 } |
1687 | 1687 |
1688 RefPtr<RenderStyle> documentStyle = renderView()->style(); | 1688 RefPtr<RenderStyle> documentStyle = renderView()->style(); |
1689 if (documentStyle->writingMode() != rootWritingMode || documentStyle->direct
ion() != rootDirection) { | 1689 if (documentStyle->writingMode() != rootWritingMode || documentStyle->direct
ion() != rootDirection) { |
1690 RefPtr<RenderStyle> newStyle = RenderStyle::clone(documentStyle.get()); | 1690 RefPtr<RenderStyle> newStyle = RenderStyle::clone(documentStyle.get()); |
1691 newStyle->setWritingMode(rootWritingMode); | 1691 newStyle->setWritingMode(rootWritingMode); |
1692 newStyle->setDirection(rootDirection); | 1692 newStyle->setDirection(rootDirection); |
1693 renderView()->setStyle(newStyle); | 1693 renderView()->setStyle(newStyle); |
1694 setStyleDependentState(newStyle.get()); | 1694 setStyleDependentState(newStyle.get()); |
1695 } | 1695 } |
1696 | 1696 |
1697 if (body) { | 1697 if (body) { |
1698 if (RenderStyle* style = body->renderStyle()) { | 1698 if (RenderStyle* style = body->renderStyle()) { |
1699 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) | 1699 if (style->direction() != rootDirection || style->writingMode() != r
ootWritingMode) |
1700 body->setNeedsStyleRecalc(); | 1700 body->setNeedsStyleRecalc(SubtreeStyleChange); |
1701 } | 1701 } |
1702 } | 1702 } |
1703 | 1703 |
1704 if (RenderStyle* style = documentElement()->renderStyle()) { | 1704 if (RenderStyle* style = documentElement()->renderStyle()) { |
1705 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) | 1705 if (style->direction() != rootDirection || style->writingMode() != rootW
ritingMode) |
1706 documentElement()->setNeedsStyleRecalc(); | 1706 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); |
1707 } | 1707 } |
1708 } | 1708 } |
1709 | 1709 |
1710 // FIXME: need a better name than recalcStyle. It's performing style invalidatio
n, style recalc, and distribution. | 1710 // FIXME: need a better name than recalcStyle. It's performing style invalidatio
n, style recalc, and distribution. |
1711 void Document::recalcStyle(StyleRecalcChange change) | 1711 void Document::recalcStyle(StyleRecalcChange change) |
1712 { | 1712 { |
1713 // we should not enter style recalc while painting | 1713 // we should not enter style recalc while painting |
1714 RELEASE_ASSERT(!view() || !view()->isPainting()); | 1714 RELEASE_ASSERT(!view() || !view()->isPainting()); |
1715 | 1715 |
1716 // FIXME: We should never enter here without a FrameView or with an inactive
document. | 1716 // FIXME: We should never enter here without a FrameView or with an inactive
document. |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 // We need to manually repaint because we avoid doing all repaints in la
yout or style | 3299 // We need to manually repaint because we avoid doing all repaints in la
yout or style |
3300 // recalc while sheets are still loading to avoid FOUC. | 3300 // recalc while sheets are still loading to avoid FOUC. |
3301 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; | 3301 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; |
3302 renderView()->repaintViewAndCompositedLayers(); | 3302 renderView()->repaintViewAndCompositedLayers(); |
3303 } | 3303 } |
3304 | 3304 |
3305 if (!change.needsStyleRecalc()) | 3305 if (!change.needsStyleRecalc()) |
3306 return; | 3306 return; |
3307 | 3307 |
3308 m_evaluateMediaQueriesOnStyleRecalc = true; | 3308 m_evaluateMediaQueriesOnStyleRecalc = true; |
3309 setNeedsStyleRecalc(); | 3309 setNeedsStyleRecalc(SubtreeStyleChange); |
3310 | 3310 |
3311 if (updateTime == RecalcStyleImmediately) | 3311 if (updateTime == RecalcStyleImmediately) |
3312 updateStyleIfNeeded(); | 3312 updateStyleIfNeeded(); |
3313 } | 3313 } |
3314 | 3314 |
3315 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) | 3315 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) |
3316 { | 3316 { |
3317 m_hoverNode = newHoverNode; | 3317 m_hoverNode = newHoverNode; |
3318 } | 3318 } |
3319 | 3319 |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4111 | 4111 |
4112 m_encodingData = newData; | 4112 m_encodingData = newData; |
4113 | 4113 |
4114 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 | 4114 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
4115 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); | 4115 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
4116 if (shouldUseVisualOrdering != m_visuallyOrdered) { | 4116 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
4117 m_visuallyOrdered = shouldUseVisualOrdering; | 4117 m_visuallyOrdered = shouldUseVisualOrdering; |
4118 // FIXME: How is possible to not have a renderer here? | 4118 // FIXME: How is possible to not have a renderer here? |
4119 if (renderView()) | 4119 if (renderView()) |
4120 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); | 4120 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); |
4121 setNeedsStyleRecalc(); | 4121 setNeedsStyleRecalc(SubtreeStyleChange); |
4122 } | 4122 } |
4123 } | 4123 } |
4124 | 4124 |
4125 KURL Document::completeURL(const String& url) const | 4125 KURL Document::completeURL(const String& url) const |
4126 { | 4126 { |
4127 return completeURLWithOverride(url, m_baseURL); | 4127 return completeURLWithOverride(url, m_baseURL); |
4128 } | 4128 } |
4129 | 4129 |
4130 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const | 4130 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const |
4131 { | 4131 { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4271 | 4271 |
4272 void Document::setTransformSource(PassOwnPtr<TransformSource> source) | 4272 void Document::setTransformSource(PassOwnPtr<TransformSource> source) |
4273 { | 4273 { |
4274 m_transformSource = source; | 4274 m_transformSource = source; |
4275 } | 4275 } |
4276 | 4276 |
4277 void Document::setDesignMode(InheritedBool value) | 4277 void Document::setDesignMode(InheritedBool value) |
4278 { | 4278 { |
4279 m_designMode = value; | 4279 m_designMode = value; |
4280 for (Frame* frame = m_frame; frame && frame->document(); frame = frame->tree
().traverseNext(m_frame)) | 4280 for (Frame* frame = m_frame; frame && frame->document(); frame = frame->tree
().traverseNext(m_frame)) |
4281 frame->document()->setNeedsStyleRecalc(); | 4281 frame->document()->setNeedsStyleRecalc(SubtreeStyleChange); |
4282 } | 4282 } |
4283 | 4283 |
4284 Document::InheritedBool Document::getDesignMode() const | 4284 Document::InheritedBool Document::getDesignMode() const |
4285 { | 4285 { |
4286 return m_designMode; | 4286 return m_designMode; |
4287 } | 4287 } |
4288 | 4288 |
4289 bool Document::inDesignMode() const | 4289 bool Document::inDesignMode() const |
4290 { | 4290 { |
4291 for (const Document* d = this; d; d = d->parentDocument()) { | 4291 for (const Document* d = this; d; d = d->parentDocument()) { |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5418 if (!page->focusController().isActive() || !page->focusController().isFocuse
d()) | 5418 if (!page->focusController().isActive() || !page->focusController().isFocuse
d()) |
5419 return false; | 5419 return false; |
5420 if (Frame* focusedFrame = page->focusController().focusedFrame()) { | 5420 if (Frame* focusedFrame = page->focusController().focusedFrame()) { |
5421 if (focusedFrame->tree().isDescendantOf(frame())) | 5421 if (focusedFrame->tree().isDescendantOf(frame())) |
5422 return true; | 5422 return true; |
5423 } | 5423 } |
5424 return false; | 5424 return false; |
5425 } | 5425 } |
5426 | 5426 |
5427 } // namespace WebCore | 5427 } // namespace WebCore |
OLD | NEW |