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

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: Fixed web/mac/WebSubstringUtil.mm Created 5 years, 10 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 77af681885b1f70c236bc486fe9e733a5ce68ab0..69fc37bdff1f6c0d81b71af305d0355c2d0ff8c0 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1634,7 +1634,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
ASSERT(inStyleRecalc());
ASSERT(documentElement());
- RefPtr<LayoutStyle> documentElementStyle = documentElement()->layoutStyle();
+ RefPtr<LayoutStyle> documentElementStyle = documentElement()->mutableLayoutStyle();
if (!documentElementStyle || documentElement()->needsStyleRecalc() || change == Force)
documentElementStyle = ensureStyleResolver().styleForElement(documentElement());
@@ -1644,7 +1644,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
HTMLElement* body = this->body();
RefPtr<LayoutStyle> bodyStyle;
if (body) {
- bodyStyle = body->layoutStyle();
+ bodyStyle = body->mutableLayoutStyle();
if (!bodyStyle || body->needsStyleRecalc() || documentElement()->needsStyleRecalc() || change == Force)
bodyStyle = ensureStyleResolver().styleForElement(body, documentElementStyle.get());
rootWritingMode = bodyStyle->writingMode();
@@ -1691,7 +1691,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
WebScrollBlocksOn scrollBlocksOn = documentElementStyle->scrollBlocksOn();
- RefPtr<LayoutStyle> documentStyle = renderView()->style();
+ RefPtr<LayoutStyle> documentStyle = renderView()->mutableStyle();
if (documentStyle->writingMode() != rootWritingMode
|| documentStyle->direction() != rootDirection
|| documentStyle->overflowX() != overflowX
@@ -1710,13 +1710,13 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
}
if (body) {
- if (LayoutStyle* style = body->layoutStyle()) {
+ if (const LayoutStyle* style = body->layoutStyle()) {
if (style->direction() != rootDirection || style->writingMode() != rootWritingMode)
body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange));
}
}
- if (LayoutStyle* style = documentElement()->layoutStyle()) {
+ if (const LayoutStyle* style = documentElement()->layoutStyle()) {
if (style->direction() != rootDirection || style->writingMode() != rootWritingMode)
documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange));
}
@@ -2414,7 +2414,7 @@ HTMLHeadElement* Document::head() const
return Traversal<HTMLHeadElement>::firstChild(*de);
}
-Element* Document::viewportDefiningElement(LayoutStyle* rootStyle) const
+Element* Document::viewportDefiningElement(const LayoutStyle* 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:
@@ -4210,7 +4210,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()->mutableStyleRef().setRTLOrdering(m_visuallyOrdered ? VisualOrder : LogicalOrder);
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::VisuallyOrdered));
}
}

Powered by Google App Engine
This is Rietveld 408576698