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

Unified Diff: Source/core/dom/Document.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix a crashers (everything is building!) Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 0e4a46cdbf2df2c7fcd0c640f33d1b21906fa442..50ad24b86c916b0d0e25521fd401bbc61e2451ba 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1636,7 +1636,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
ASSERT(inStyleRecalc());
ASSERT(documentElement());
- RefPtr<RenderStyle> documentElementStyle = documentElement()->renderStyle();
+ RefPtr<RenderStyle> documentElementStyle = documentElement()->mutableRenderStyle();
if (!documentElementStyle || documentElement()->needsStyleRecalc() || change == Force)
documentElementStyle = ensureStyleResolver().styleForElement(documentElement());
@@ -1646,7 +1646,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
HTMLElement* body = this->body();
RefPtr<RenderStyle> bodyStyle;
if (body) {
- bodyStyle = body->renderStyle();
+ bodyStyle = body->mutableRenderStyle();
if (!bodyStyle || body->needsStyleRecalc() || documentElement()->needsStyleRecalc() || change == Force)
bodyStyle = ensureStyleResolver().styleForElement(body, documentElementStyle.get());
rootWritingMode = bodyStyle->writingMode();
@@ -1693,7 +1693,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn();
- RefPtr<RenderStyle> documentStyle = renderView()->style();
+ RefPtr<RenderStyle> documentStyle = renderView()->deprecatedMutableStyle();
if (documentStyle->writingMode() != rootWritingMode
|| documentStyle->direction() != rootDirection
|| documentStyle->overflowX() != overflowX
@@ -1712,13 +1712,13 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
}
if (body) {
- if (RenderStyle* style = body->renderStyle()) {
+ if (const RenderStyle* style = body->renderStyle()) {
if (style->direction() != rootDirection || style->writingMode() != rootWritingMode)
body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange));
}
}
- if (RenderStyle* style = documentElement()->renderStyle()) {
+ if (const RenderStyle* style = documentElement()->renderStyle()) {
if (style->direction() != rootDirection || style->writingMode() != rootWritingMode)
documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange));
}
@@ -2423,7 +2423,7 @@ HTMLHeadElement* Document::head() const
return Traversal<HTMLHeadElement>::firstChild(*de);
}
-Element* Document::viewportDefiningElement(RenderStyle* rootStyle) const
+Element* Document::viewportDefiningElement(const RenderStyle* rootStyle) const
{
// If a BODY element sets non-visible overflow, it is to be propagated to the viewport, as long
// as the following conditions are all met:
@@ -4219,7 +4219,7 @@ void Document::setEncodingData(const DocumentEncodingData& newData)
m_visuallyOrdered = shouldUseVisualOrdering;
// FIXME: How is possible to not have a renderer here?
if (renderView())
- renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
+ renderView()->deprecatedMutableStyle()->setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::VisuallyOrdered));
}
}

Powered by Google App Engine
This is Rietveld 408576698