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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.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 unified diff | Download patch
OLDNEW
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 Uncached 3010 Uncached
3011 }; 3011 };
3012 3012
3013 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS tate type, const LayoutObject* layoutObject, ComputedStyle* style) 3013 static PassRefPtr<ComputedStyle> firstLineStyleForCachedUncachedType(StyleCacheS tate type, const LayoutObject* layoutObject, ComputedStyle* style)
3014 { 3014 {
3015 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject; 3015 const LayoutObject* layoutObjectForFirstLineStyle = layoutObject;
3016 if (layoutObject->isBeforeOrAfterContent()) 3016 if (layoutObject->isBeforeOrAfterContent())
3017 layoutObjectForFirstLineStyle = layoutObject->parent(); 3017 layoutObjectForFirstLineStyle = layoutObject->parent();
3018 3018
3019 if (layoutObjectForFirstLineStyle->canHaveFirstLineOrFirstLetterStyle()) { 3019 if (layoutObjectForFirstLineStyle->canHaveFirstLineOrFirstLetterStyle()) {
3020 if (LayoutBlock* firstLineBlock = toLayoutBlock(layoutObjectForFirstLine Style)->enclosingFirstLineStyleBlock()) { 3020 if (const LayoutBlock* firstLineBlock = toLayoutBlock(layoutObjectForFir stLineStyle)->enclosingFirstLineStyleBlock()) {
3021 if (type == Cached) 3021 if (type == Cached)
3022 return firstLineBlock->getCachedPseudoStyle(PseudoIdFirstLine, s tyle); 3022 return firstLineBlock->getCachedPseudoStyle(PseudoIdFirstLine, s tyle);
3023 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(Pse udoIdFirstLine), style, firstLineBlock == layoutObject ? style : 0); 3023 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(Pse udoIdFirstLine), style, firstLineBlock == layoutObject ? style : 0);
3024 } 3024 }
3025 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF irstLineStyle->isLayoutInline() 3025 } else if (!layoutObjectForFirstLineStyle->isAnonymous() && layoutObjectForF irstLineStyle->isLayoutInline()
3026 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement()) { 3026 && !layoutObjectForFirstLineStyle->node()->isFirstLetterPseudoElement()) {
3027 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent ()->firstLineStyle(); 3027 const ComputedStyle* parentStyle = layoutObjectForFirstLineStyle->parent ()->firstLineStyle();
3028 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) { 3028 if (parentStyle != layoutObjectForFirstLineStyle->parent()->style()) {
3029 if (type == Cached) { 3029 if (type == Cached) {
3030 // A first-line style is in effect. Cache a first-line style for ourselves. 3030 // A first-line style is in effect. Cache a first-line style for ourselves.
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 const blink::LayoutObject* root = object1; 3699 const blink::LayoutObject* root = object1;
3700 while (root->parent()) 3700 while (root->parent())
3701 root = root->parent(); 3701 root = root->parent();
3702 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3702 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3703 } else { 3703 } else {
3704 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3704 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3705 } 3705 }
3706 } 3706 }
3707 3707
3708 #endif 3708 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698