Chromium Code Reviews| 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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1992 } | 1992 } |
| 1993 if (!haveNormalFlowChild && hasLineIfEmpty()) { | 1993 if (!haveNormalFlowChild && hasLineIfEmpty()) { |
| 1994 const FontMetrics& fontMetrics = firstLineStyle()->getFontMetrics(); | 1994 const FontMetrics& fontMetrics = firstLineStyle()->getFontMetrics(); |
| 1995 return fontMetrics.ascent() | 1995 return fontMetrics.ascent() |
| 1996 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fo ntMetrics.height()) / 2 | 1996 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fo ntMetrics.height()) / 2 |
| 1997 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : bo rderRight() + paddingRight()); | 1997 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : bo rderRight() + paddingRight()); |
| 1998 } | 1998 } |
| 1999 return -1; | 1999 return -1; |
| 2000 } | 2000 } |
| 2001 | 2001 |
| 2002 LayoutBlock* LayoutBlock::enclosingFirstLineStyleBlock() const | 2002 const LayoutBlock* LayoutBlock::enclosingFirstLineStyleBlock() const |
| 2003 { | 2003 { |
| 2004 LayoutBlock* firstLineBlock = const_cast<LayoutBlock*>(this); | 2004 const LayoutBlock* firstLineBlock = this; |
| 2005 bool hasPseudo = false; | 2005 bool hasPseudo = false; |
| 2006 while (true) { | 2006 while (true) { |
| 2007 hasPseudo = firstLineBlock->style()->hasPseudoStyle(PseudoIdFirstLine); | 2007 hasPseudo = firstLineBlock->style()->hasPseudoStyle(PseudoIdFirstLine); |
| 2008 if (hasPseudo) | 2008 if (hasPseudo) |
| 2009 break; | 2009 break; |
| 2010 LayoutObject* parentBlock = firstLineBlock->parent(); | 2010 LayoutObject* parentBlock = firstLineBlock->parent(); |
| 2011 if (firstLineBlock->isAtomicInlineLevel() || firstLineBlock->isFloatingO rOutOfFlowPositioned() | 2011 if (firstLineBlock->isAtomicInlineLevel() || firstLineBlock->isFloatingO rOutOfFlowPositioned() |
| 2012 || !parentBlock | 2012 || !parentBlock |
| 2013 || !parentBlock->canHaveFirstLineOrFirstLetterStyle()) | 2013 || !parentBlock->canHaveFirstLineOrFirstLetterStyle()) |
| 2014 break; | 2014 break; |
| 2015 ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isLayoutBlock()); | 2015 ASSERT_WITH_SECURITY_IMPLICATION(parentBlock->isLayoutBlock()); |
| 2016 if (toLayoutBlock(parentBlock)->firstChild() != firstLineBlock) | 2016 if (toLayoutBlock(parentBlock)->firstChild() != firstLineBlock) |
| 2017 break; | 2017 break; |
| 2018 firstLineBlock = toLayoutBlock(parentBlock); | 2018 firstLineBlock = toLayoutBlock(parentBlock); |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 if (!hasPseudo) | 2021 if (!hasPseudo) |
| 2022 return nullptr; | 2022 return nullptr; |
| 2023 | 2023 |
| 2024 return firstLineBlock; | 2024 return firstLineBlock; |
| 2025 } | 2025 } |
| 2026 | 2026 |
| 2027 LayoutBlockFlow* LayoutBlock::nearestInnerBlockWithFirstLine() const | 2027 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
| |
| 2028 { | 2028 { |
| 2029 if (childrenInline()) | 2029 if (childrenInline()) |
| 2030 return toLayoutBlockFlow(const_cast<LayoutBlock*>(this)); | 2030 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
| |
| 2031 for (LayoutObject* child = firstChild(); child && !child->isFloatingOrOutOfF lowPositioned() && child->isLayoutBlockFlow(); child = toLayoutBlock(child)->fir stChild()) { | 2031 for (LayoutObject* child = firstChild(); child && !child->isFloatingOrOutOfF lowPositioned() && child->isLayoutBlockFlow(); child = toLayoutBlock(child)->fir stChild()) { |
| 2032 if (child->childrenInline()) | 2032 if (child->childrenInline()) |
| 2033 return toLayoutBlockFlow(child); | 2033 return toLayoutBlockFlow(child); |
| 2034 } | 2034 } |
| 2035 return nullptr; | 2035 return nullptr; |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 void LayoutBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accum ulatedOffset) const | 2038 void LayoutBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accum ulatedOffset) const |
| 2039 { | 2039 { |
| 2040 // For blocks inside inlines, we go ahead and include margins so that we run right up to the | 2040 // For blocks inside inlines, we go ahead and include margins so that we run right up to the |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2379 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { | 2379 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { |
| 2380 LayoutBox* currBox = *it; | 2380 LayoutBox* currBox = *it; |
| 2381 ASSERT(!currBox->needsLayout()); | 2381 ASSERT(!currBox->needsLayout()); |
| 2382 } | 2382 } |
| 2383 } | 2383 } |
| 2384 } | 2384 } |
| 2385 | 2385 |
| 2386 #endif | 2386 #endif |
| 2387 | 2387 |
| 2388 } // namespace blink | 2388 } // namespace blink |
| OLD | NEW |