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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1961343002: Adjust constness to avoid const_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LayoutBlock::enclosingFirstLineStyleBlock() also had a const_cast that can be eliminated easily. Created 4 years, 7 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: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index bc46a2b38b836012f8081342507ed02f5b264f16..8c7a41f3163febe910500daf647efe45bb838785 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1999,9 +1999,9 @@ int LayoutBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const
return -1;
}
-LayoutBlock* LayoutBlock::enclosingFirstLineStyleBlock() const
+const LayoutBlock* LayoutBlock::enclosingFirstLineStyleBlock() const
{
- LayoutBlock* firstLineBlock = const_cast<LayoutBlock*>(this);
+ const LayoutBlock* firstLineBlock = this;
bool hasPseudo = false;
while (true) {
hasPseudo = firstLineBlock->style()->hasPseudoStyle(PseudoIdFirstLine);
@@ -2024,10 +2024,10 @@ LayoutBlock* LayoutBlock::enclosingFirstLineStyleBlock() const
return firstLineBlock;
}
-LayoutBlockFlow* LayoutBlock::nearestInnerBlockWithFirstLine() const
+LayoutBlockFlow* LayoutBlock::nearestInnerBlockWithFirstLine()
eae 2016/05/10 15:40:54 Can this return a const LayoutBlockFlow?
mstensho (USE GERRIT) 2016/05/10 15:58:16 The caller calls non-const methods on the returned
{
if (childrenInline())
- return toLayoutBlockFlow(const_cast<LayoutBlock*>(this));
+ return toLayoutBlockFlow(this);
eae 2016/05/10 15:40:54 Could we add a const version of toLayoutBlockFlow
mstensho (USE GERRIT) 2016/05/10 15:58:16 The DEFINE_LAYOUT_OBJECT_TYPE_CASTS macro already
for (LayoutObject* child = firstChild(); child && !child->isFloatingOrOutOfFlowPositioned() && child->isLayoutBlockFlow(); child = toLayoutBlock(child)->firstChild()) {
if (child->childrenInline())
return toLayoutBlockFlow(child);
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698