OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 | 1944 |
1945 int count = 0; | 1945 int count = 0; |
1946 for (const RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox(
)) { | 1946 for (const RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox(
)) { |
1947 count++; | 1947 count++; |
1948 if (box == stopRootInlineBox) | 1948 if (box == stopRootInlineBox) |
1949 break; | 1949 break; |
1950 } | 1950 } |
1951 return count; | 1951 return count; |
1952 } | 1952 } |
1953 | 1953 |
| 1954 int LayoutBlockFlow::firstLineBoxBaseline() const |
| 1955 { |
| 1956 if (isWritingModeRoot() && !isRubyRun()) |
| 1957 return -1; |
| 1958 if (!childrenInline()) |
| 1959 return LayoutBlock::firstLineBoxBaseline(); |
| 1960 if (firstLineBox()) |
| 1961 return firstLineBox()->logicalTop() + style(true)->getFontMetrics().asce
nt(firstRootBox()->baselineType()); |
| 1962 return -1; |
| 1963 } |
| 1964 |
| 1965 int LayoutBlockFlow::inlineBlockBaseline(LineDirectionMode lineDirection) const |
| 1966 { |
| 1967 // CSS2.1 states that the baseline of an 'inline-block' is: |
| 1968 // the baseline of the last line box in the normal flow, unless it has |
| 1969 // either no in-flow line boxes or if its 'overflow' property has a computed |
| 1970 // value other than 'visible', in which case the baseline is the bottom |
| 1971 // margin edge. |
| 1972 // We likewise avoid using the last line box in the case of size containment
, |
| 1973 // where the block's contents shouldn't be considered when laying out its |
| 1974 // ancestors or siblings. |
| 1975 |
| 1976 if ((!style()->isOverflowVisible() && !shouldIgnoreOverflowPropertyForInline
BlockBaseline()) || style()->containsSize()) { |
| 1977 // We are not calling baselinePosition here because the caller should ad
d the margin-top/margin-right, not us. |
| 1978 return lineDirection == HorizontalLine ? size().height() + marginBottom(
) : size().width() + marginLeft(); |
| 1979 } |
| 1980 if (isWritingModeRoot() && !isRubyRun()) |
| 1981 return -1; |
| 1982 if (!childrenInline()) |
| 1983 return LayoutBlock::inlineBlockBaseline(lineDirection); |
| 1984 if (lastLineBox()) |
| 1985 return lastLineBox()->logicalTop() + style(lastLineBox() == firstLineBox
())->getFontMetrics().ascent(lastRootBox()->baselineType()); |
| 1986 if (!hasLineIfEmpty()) |
| 1987 return -1; |
| 1988 const FontMetrics& fontMetrics = firstLineStyle()->getFontMetrics(); |
| 1989 return fontMetrics.ascent() |
| 1990 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMe
trics.height()) / 2 |
| 1991 + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : border
Right() + paddingRight()); |
| 1992 } |
| 1993 |
1954 void LayoutBlockFlow::removeFloatingObjectsFromDescendants() | 1994 void LayoutBlockFlow::removeFloatingObjectsFromDescendants() |
1955 { | 1995 { |
1956 if (!containsFloats()) | 1996 if (!containsFloats()) |
1957 return; | 1997 return; |
1958 removeFloatingObjects(); | 1998 removeFloatingObjects(); |
1959 setChildNeedsLayout(MarkOnlyThis); | 1999 setChildNeedsLayout(MarkOnlyThis); |
1960 | 2000 |
1961 // If our children are inline, then the only boxes which could contain float
s are atomic inlines (e.g. inline-block, float etc.) | 2001 // If our children are inline, then the only boxes which could contain float
s are atomic inlines (e.g. inline-block, float etc.) |
1962 // and these create formatting contexts, so can't pick up intruding floats f
rom ancestors/siblings - making them safe to skip. | 2002 // and these create formatting contexts, so can't pick up intruding floats f
rom ancestors/siblings - making them safe to skip. |
1963 if (childrenInline()) | 2003 if (childrenInline()) |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3117 // FIXME: Glyph overflow will get lost in this case, but not really a big de
al. | 3157 // FIXME: Glyph overflow will get lost in this case, but not really a big de
al. |
3118 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 3158 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
3119 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it
!= lineBoxes.end(); ++it) { | 3159 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it
!= lineBoxes.end(); ++it) { |
3120 RootInlineBox* box = *it; | 3160 RootInlineBox* box = *it; |
3121 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataMap); | 3161 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataMap); |
3122 } | 3162 } |
3123 return childrenOverflowChanged; | 3163 return childrenOverflowChanged; |
3124 } | 3164 } |
3125 | 3165 |
3126 } // namespace blink | 3166 } // namespace blink |
OLD | NEW |