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

Side by Side Diff: Source/core/layout/LayoutBlockFlowLine.cpp

Issue 1328673003: Remove -webkit-line-box-contain implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix up a few more tests. Created 5 years, 3 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
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return false; 101 return false;
102 } 102 }
103 103
104 InlineFlowBox* LayoutBlockFlow::createLineBoxes(LayoutObject* obj, const LineInf o& lineInfo, InlineBox* childBox) 104 InlineFlowBox* LayoutBlockFlow::createLineBoxes(LayoutObject* obj, const LineInf o& lineInfo, InlineBox* childBox)
105 { 105 {
106 // See if we have an unconstructed line box for this object that is also 106 // See if we have an unconstructed line box for this object that is also
107 // the last item on the line. 107 // the last item on the line.
108 unsigned lineDepth = 1; 108 unsigned lineDepth = 1;
109 InlineFlowBox* parentBox = nullptr; 109 InlineFlowBox* parentBox = nullptr;
110 InlineFlowBox* result = nullptr; 110 InlineFlowBox* result = nullptr;
111 bool hasDefaultLineBoxContain = style()->lineBoxContain() == ComputedStyle:: initialLineBoxContain();
112 do { 111 do {
113 ASSERT_WITH_SECURITY_IMPLICATION(obj->isLayoutInline() || obj == this); 112 ASSERT_WITH_SECURITY_IMPLICATION(obj->isLayoutInline() || obj == this);
114 113
115 LayoutInline* inlineFlow = (obj != this) ? toLayoutInline(obj) : 0; 114 LayoutInline* inlineFlow = (obj != this) ? toLayoutInline(obj) : 0;
116 115
117 // Get the last box we made for this layout object. 116 // Get the last box we made for this layout object.
118 parentBox = inlineFlow ? inlineFlow->lastLineBox() : toLayoutBlock(obj)- >lastLineBox(); 117 parentBox = inlineFlow ? inlineFlow->lastLineBox() : toLayoutBlock(obj)- >lastLineBox();
119 118
120 // If this box or its ancestor is constructed then it is from a previous line, and we need 119 // If this box or its ancestor is constructed then it is from a previous line, and we need
121 // to make a new box for our line. If this box or its ancestor is uncon structed but it has 120 // to make a new box for our line. If this box or its ancestor is uncon structed but it has
122 // something following it on the line, then we know we have to make a ne w box 121 // something following it on the line, then we know we have to make a ne w box
123 // as well. In this situation our inline has actually been split in two on 122 // as well. In this situation our inline has actually been split in two on
124 // the same line (this can happen with very fancy language mixtures). 123 // the same line (this can happen with very fancy language mixtures).
125 bool constructedNewBox = false; 124 bool constructedNewBox = false;
126 bool allowedToConstructNewBox = !hasDefaultLineBoxContain || !inlineFlow || inlineFlow->alwaysCreateLineBoxes(); 125 bool allowedToConstructNewBox = !inlineFlow || inlineFlow->alwaysCreateL ineBoxes();
127 bool canUseExistingParentBox = parentBox && !parentIsConstructedOrHaveNe xt(parentBox); 126 bool canUseExistingParentBox = parentBox && !parentIsConstructedOrHaveNe xt(parentBox);
128 if (allowedToConstructNewBox && !canUseExistingParentBox) { 127 if (allowedToConstructNewBox && !canUseExistingParentBox) {
129 // We need to make a new box for this layout object. Once 128 // We need to make a new box for this layout object. Once
130 // made, we need to place it at the end of the current line. 129 // made, we need to place it at the end of the current line.
131 InlineBox* newBox = createInlineBoxForLayoutObject(obj, obj == this) ; 130 InlineBox* newBox = createInlineBoxForLayoutObject(obj, obj == this) ;
132 ASSERT_WITH_SECURITY_IMPLICATION(newBox->isInlineFlowBox()); 131 ASSERT_WITH_SECURITY_IMPLICATION(newBox->isInlineFlowBox());
133 parentBox = toInlineFlowBox(newBox); 132 parentBox = toInlineFlowBox(newBox);
134 parentBox->setFirstLineStyleBit(lineInfo.isFirstLine()); 133 parentBox->setFirstLineStyleBit(lineInfo.isFirstLine());
135 parentBox->setIsHorizontal(isHorizontalWritingMode()); 134 parentBox->setIsHorizontal(isHorizontalWritingMode());
136 if (!hasDefaultLineBoxContain)
137 parentBox->clearDescendantsHaveSameLineHeightAndBaseline();
138 constructedNewBox = true; 135 constructedNewBox = true;
139 } 136 }
140 137
141 if (constructedNewBox || canUseExistingParentBox) { 138 if (constructedNewBox || canUseExistingParentBox) {
142 if (!result) 139 if (!result)
143 result = parentBox; 140 result = parentBox;
144 141
145 // If we have hit the block itself, then |box| represents the root 142 // If we have hit the block itself, then |box| represents the root
146 // inline box for the line, and it doesn't have to be appended to an y parent 143 // inline box for the line, and it doesn't have to be appended to an y parent
147 // inline. 144 // inline.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 setMarginEndForChild(*layoutRubyRun, -endOverhang); 364 setMarginEndForChild(*layoutRubyRun, -endOverhang);
368 } 365 }
369 366
370 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru n, LayoutText* layoutText, LayoutUnit xPos, const LineInfo& lineInfo, 367 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru n, LayoutText* layoutText, LayoutUnit xPos, const LineInfo& lineInfo,
371 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ver ticalPositionCache, WordMeasurements& wordMeasurements) 368 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& ver ticalPositionCache, WordMeasurements& wordMeasurements)
372 { 369 {
373 HashSet<const SimpleFontData*> fallbackFonts; 370 HashSet<const SimpleFontData*> fallbackFonts;
374 GlyphOverflow glyphOverflow; 371 GlyphOverflow glyphOverflow;
375 372
376 const Font& font = layoutText->style(lineInfo.isFirstLine())->font(); 373 const Font& font = layoutText->style(lineInfo.isFirstLine())->font();
377 // Always compute glyph overflow bounds if the block's line-box-contain valu e is "glyphs".
378 if (lineBox->fitsToGlyphs())
379 glyphOverflow.computeBounds = true;
380 374
381 LayoutUnit hyphenWidth = 0; 375 LayoutUnit hyphenWidth = 0;
382 if (toInlineTextBox(run->m_box)->hasHyphen()) 376 if (toInlineTextBox(run->m_box)->hasHyphen())
383 hyphenWidth = layoutText->hyphenWidth(font, run->direction()); 377 hyphenWidth = layoutText->hyphenWidth(font, run->direction());
384 378
385 float measuredWidth = 0; 379 float measuredWidth = 0;
386 FloatRect glyphBounds; 380 FloatRect glyphBounds;
387 381
388 bool kerningIsEnabled = font.fontDescription().typesettingFeatures() & Kerni ng; 382 bool kerningIsEnabled = font.fontDescription().typesettingFeatures() & Kerni ng;
389 383
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2033 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
2040 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft; 2034 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight() , false) - logicalLeft;
2041 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2035 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2042 2036
2043 if (!style()->isLeftToRightDirection()) 2037 if (!style()->isLeftToRightDirection())
2044 return logicalWidth() - logicalLeft; 2038 return logicalWidth() - logicalLeft;
2045 return logicalLeft; 2039 return logicalLeft;
2046 } 2040 }
2047 2041
2048 } 2042 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698