Changeset 211292 in webkit
- Timestamp:
- Jan 27, 2017 11:24:26 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r211289 r211292 1 2017-01-27 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Do not bail out on -webkit-line-box-contain: block glyphs unless text overflows vertically. 4 https://bugs.webkit.org/show_bug.cgi?id=167481 5 <rdar://problem/30180150> 6 7 Reviewed by Antti Koivisto. 8 9 * fast/text/simple-line-layout-line-box-contain-glyphs-expected.html: Added. 10 * fast/text/simple-line-layout-line-box-contain-glyphs.html: Added. 11 1 12 2017-01-27 Devin Rousso <dcrousso+webkit@gmail.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r211291 r211292 1 2017-01-27 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Do not bail out on -webkit-line-box-contain: block glyphs unless text overflows vertically. 4 https://bugs.webkit.org/show_bug.cgi?id=167481 5 <rdar://problem/30180150> 6 7 Reviewed by Antti Koivisto. 8 9 Since -webkit-line-box-contain: glyphs requires variable line height support, we can use simple line layout 10 only when each line happen to have the same height ('block' property value is set, glyphs do not overflow the block line height). 11 12 Test: fast/text/simple-line-layout-line-box-contain-glyphs.html 13 14 * rendering/SimpleLineLayout.cpp: 15 (WebCore::SimpleLineLayout::canUseForText): 16 (WebCore::SimpleLineLayout::canUseForFontAndText): 17 (WebCore::SimpleLineLayout::canUseForStyle): 18 (WebCore::SimpleLineLayout::printReason): 19 1 20 2017-01-27 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r211228 r211292 113 113 FlowChildIsSelected = 1LLU << 47, 114 114 FlowHasHangingPunctuation = 1LLU << 48, 115 EndOfReasons = 1LLU << 49 115 FlowFontHasOverflowGlyph = 1LLU << 49, 116 EndOfReasons = 1LLU << 50 116 117 }; 117 118 const unsigned NoReason = 0; … … 137 138 138 139 template <typename CharacterType> 139 static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned length, const Font& font, bool textIsJustified, IncludeReasons includeReasons) 140 static AvoidanceReasonFlags canUseForText(const CharacterType* text, unsigned length, const Font& font, std::optional<float> lineHeightConstraint, 141 bool textIsJustified, IncludeReasons includeReasons) 140 142 { 141 143 AvoidanceReasonFlags reasons = { }; … … 167 169 SET_REASON_AND_RETURN_IF_NEEDED(FlowTextHasDirectionCharacter, reasons, includeReasons); 168 170 169 if (!font.glyphForCharacter(character)) 171 auto glyph = font.glyphForCharacter(character); 172 if (!glyph) 170 173 SET_REASON_AND_RETURN_IF_NEEDED(FlowFontIsMissingGlyph, reasons, includeReasons); 174 if (lineHeightConstraint && font.boundsForGlyph(glyph).height() > *lineHeightConstraint) 175 SET_REASON_AND_RETURN_IF_NEEDED(FlowFontHasOverflowGlyph, reasons, includeReasons); 171 176 } 172 177 return reasons; 173 178 } 174 179 175 static AvoidanceReasonFlags canUseForText(const RenderText& textRenderer, const Font& font, bool textIsJustified, IncludeReasons includeReasons)180 static AvoidanceReasonFlags canUseForText(const RenderText& textRenderer, const Font& font, std::optional<float> lineHeightConstraint, bool textIsJustified, IncludeReasons includeReasons) 176 181 { 177 182 if (textRenderer.is8Bit()) 178 return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font, false, includeReasons);179 return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font, textIsJustified, includeReasons);183 return canUseForText(textRenderer.characters8(), textRenderer.textLength(), font, lineHeightConstraint, false, includeReasons); 184 return canUseForText(textRenderer.characters16(), textRenderer.textLength(), font, lineHeightConstraint, textIsJustified, includeReasons); 180 185 } 181 186 … … 188 193 if (primaryFont.isLoading()) 189 194 SET_REASON_AND_RETURN_IF_NEEDED(FlowIsMissingPrimaryFont, reasons, includeReasons); 190 195 std::optional<float> lineHeightConstraint; 196 if (style.lineBoxContain() & LineBoxContainGlyphs) 197 lineHeightConstraint = lineHeightFromFlow(flow).toFloat(); 191 198 bool flowIsJustified = style.textAlign() == JUSTIFY; 192 199 for (const auto& textRenderer : childrenOfType<RenderText>(flow)) { … … 204 211 SET_REASON_AND_RETURN_IF_NEEDED(FlowFontIsNotSimple, reasons, includeReasons); 205 212 206 auto textReasons = canUseForText(textRenderer, primaryFont, flowIsJustified, includeReasons);213 auto textReasons = canUseForText(textRenderer, primaryFont, lineHeightConstraint, flowIsJustified, includeReasons); 207 214 if (textReasons != NoReason) 208 215 SET_REASON_AND_RETURN_IF_NEEDED(textReasons, reasons, includeReasons); … … 223 230 if (!style.isLeftToRightDirection()) 224 231 SET_REASON_AND_RETURN_IF_NEEDED(FlowIsNotLTR, reasons, includeReasons); 225 if ( style.lineBoxContain() != RenderStyle::initialLineBoxContain())232 if (!(style.lineBoxContain() & LineBoxContainBlock)) 226 233 SET_REASON_AND_RETURN_IF_NEEDED(FlowHasLineBoxContainProperty, reasons, includeReasons); 227 234 if (style.writingMode() != TopToBottomWritingMode) … … 978 985 break; 979 986 case FlowHasLineBoxContainProperty: 980 stream << "line-box-contain property";987 stream << "line-box-contain value indicates variable line height"; 981 988 break; 982 989 case FlowIsNotTopToBottom: … … 1060 1067 case FlowChildIsSelected: 1061 1068 stream << "selected content"; 1069 break; 1070 case FlowFontHasOverflowGlyph: 1071 stream << "-webkit-line-box-contain: glyphs with overflowing text."; 1062 1072 break; 1063 1073 case FlowTextIsEmpty:
Note: See TracChangeset
for help on using the changeset viewer.