Changeset 156025 in webkit
- Timestamp:
- Sep 17, 2013, 11:30:30 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r156024 r156025 1 2013-09-17 Antti Koivisto <antti@apple.com> 2 3 Rename InlineBox::isText() 4 <https://webkit.org/b/121525> 5 6 Reviewed by Andreas Kling. 7 8 The flag sounds like RenderObject::isText() yet it can be set for some inline boxes generated 9 for non-text renderers too (br, list markers). This is pretty confusing. 10 11 Rename to InlineBox::behavesLikeText(). 12 13 * rendering/InlineBox.cpp: 14 (WebCore::InlineBox::logicalHeight): 15 (WebCore::InlineBox::baselinePosition): 16 (WebCore::InlineBox::lineHeight): 17 * rendering/InlineBox.h: 18 (WebCore::InlineBox::behavesLikeText): 19 (WebCore::InlineBox::setBehavesLikeText): 20 (WebCore::InlineBox::InlineBoxBitfields::InlineBoxBitfields): 21 * rendering/InlineFlowBox.cpp: 22 (WebCore::InlineFlowBox::addToLine): 23 (WebCore::InlineFlowBox::placeBoxesInBlockDirection): 24 * rendering/InlineTextBox.cpp: 25 (WebCore::InlineTextBox::baselinePosition): 26 (WebCore::InlineTextBox::lineHeight): 27 * rendering/RenderBlockLineLayout.cpp: 28 (WebCore::createInlineBoxForRenderer): 29 (WebCore::setLogicalWidthForTextRun): 30 * rendering/RenderListMarker.cpp: 31 (WebCore::RenderListMarker::createInlineBox): 32 * rendering/RenderText.cpp: 33 (WebCore::RenderText::createInlineTextBox): 34 * rendering/RootInlineBox.cpp: 35 (WebCore::RootInlineBox::includeLeadingForBox): 36 (WebCore::RootInlineBox::includeFontForBox): 37 (WebCore::RootInlineBox::includeGlyphsForBox): 38 (WebCore::RootInlineBox::includeMarginForBox): 39 40 Switch tests from isText() to isTextOrBR(). This matches the behavior before r155957. 41 I don't know if there is a case where this actually makes any difference in behavior. 42 1 43 2013-09-17 Sam Weinig <sam@webkit.org> 2 44 -
trunk/Source/WebCore/rendering/InlineBox.cpp
r155975 r156025 143 143 144 144 if (renderer().isTextOrBR()) 145 return m_bitfields.isText() ? renderer().style(isFirstLineStyle())->fontMetrics().height() : 0;145 return behavesLikeText() ? renderer().style(isFirstLineStyle())->fontMetrics().height() : 0; 146 146 if (renderer().isBox() && parent()) 147 147 return isHorizontal() ? toRenderBox(renderer()).height() : toRenderBox(renderer()).width(); … … 158 158 int InlineBox::baselinePosition(FontBaseline baselineType) const 159 159 { 160 if (renderer().isBR() && ! isText())160 if (renderer().isBR() && !behavesLikeText()) 161 161 return 0; 162 162 return boxModelObject()->baselinePosition(baselineType, m_bitfields.firstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); … … 165 165 LayoutUnit InlineBox::lineHeight() const 166 166 { 167 if (renderer().isBR() && ! isText())167 if (renderer().isBR() && !behavesLikeText()) 168 168 return 0; 169 169 return boxModelObject()->lineHeight(m_bitfields.firstLine(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); -
trunk/Source/WebCore/rendering/InlineBox.h
r155957 r156025 118 118 #endif 119 119 120 bool isText() const { return m_bitfields.isText(); }121 void set IsText(bool isText) { m_bitfields.setIsText(isText); }120 bool behavesLikeText() const { return m_bitfields.behavesLikeText(); } 121 void setBehavesLikeText(bool behavesLikeText) { m_bitfields.setBehavesLikeText(behavesLikeText); } 122 122 123 123 virtual bool isInlineFlowBox() const { return false; } … … 337 337 , m_hasEllipsisBoxOrHyphen(false) 338 338 , m_dirOverride(false) 339 , m_ isText(false)339 , m_behavesLikeText(false) 340 340 , m_determinedIfNextOnLineExists(false) 341 341 , m_nextOnLineExists(false) … … 368 368 // for InlineTextBox 369 369 ADD_BOOLEAN_BITFIELD(dirOverride, DirOverride); 370 ADD_BOOLEAN_BITFIELD( isText, IsText); // Whether or not this object represents text with a non-zero height. Includes non-image list markers, text boxes.370 ADD_BOOLEAN_BITFIELD(behavesLikeText, BehavesLikeText); // Whether or not this object represents text with a non-zero height. Includes non-image list markers, text boxes, br. 371 371 372 372 private: -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r155957 r156025 112 112 child->setFirstLineStyleBit(isFirstLineStyle()); 113 113 child->setIsHorizontal(isHorizontal()); 114 if (child-> isText()) {114 if (child->behavesLikeText()) { 115 115 if (child->renderer().parent() == &renderer()) 116 116 m_hasTextChildren = true; … … 127 127 if (child->renderer().isReplaced()) 128 128 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; 129 else if (child-> isText()) {129 else if (child->behavesLikeText()) { 130 130 if (child->renderer().isBR() || child->renderer().parent() != &renderer()) { 131 131 if (!parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle->font().fontMetrics()) … … 159 159 160 160 if (!child->renderer().isOutOfFlowPositioned()) { 161 if (child-> isText()) {161 if (child->behavesLikeText()) { 162 162 RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()); 163 163 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeWidth()) … … 660 660 LayoutUnit boxHeightIncludingMargins = boxHeight; 661 661 662 if (curr-> isText() || curr->isInlineFlowBox()) {662 if (curr->behavesLikeText() || curr->isInlineFlowBox()) { 663 663 const FontMetrics& fontMetrics = curr->renderer().style(isFirstLineStyle())->fontMetrics(); 664 664 newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.ascent(baselineType); -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r155957 r156025 99 99 int InlineTextBox::baselinePosition(FontBaseline baselineType) const 100 100 { 101 if (! isText() || !parent())101 if (!behavesLikeText() || !parent()) 102 102 return 0; 103 103 if (&parent()->renderer() == renderer().parent()) … … 108 108 LayoutUnit InlineTextBox::lineHeight() const 109 109 { 110 if (! isText() || !renderer().parent())110 if (!behavesLikeText() || !renderer().parent()) 111 111 return 0; 112 112 if (&parent()->renderer() == renderer().parent()) -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r156022 r156025 275 275 // We only treat a box as text for a <br> if we are on a line by ourself or in strict mode 276 276 // (Note the use of strict mode. In "almost strict" mode, we don't treat the box for <br> as text.) 277 inlineBox->set IsText(isOnlyRun || obj->document().inNoQuirksMode());277 inlineBox->setBehavesLikeText(isOnlyRun || obj->document().inNoQuirksMode()); 278 278 return inlineBox; 279 279 } … … 657 657 run->m_box->setLogicalWidth(measuredWidth + hyphenWidth); 658 658 if (!fallbackFonts.isEmpty()) { 659 ASSERT(run->m_box-> isText());659 ASSERT(run->m_box->behavesLikeText()); 660 660 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(toInlineTextBox(run->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator; 661 661 ASSERT(it->value.first.isEmpty()); … … 664 664 } 665 665 if ((glyphOverflow.top || glyphOverflow.bottom || glyphOverflow.left || glyphOverflow.right)) { 666 ASSERT(run->m_box-> isText());666 ASSERT(run->m_box->behavesLikeText()); 667 667 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(toInlineTextBox(run->m_box), make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator; 668 668 it->value.second = glyphOverflow; -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r155908 r156025 1165 1165 { 1166 1166 InlineBox* result = RenderBox::createInlineBox(); 1167 result->set IsText(isText());1167 result->setBehavesLikeText(isText()); 1168 1168 return result; 1169 1169 } -
trunk/Source/WebCore/rendering/RenderText.cpp
r155957 r156025 1439 1439 m_lastTextBox = textBox; 1440 1440 } 1441 textBox->set IsText(true);1441 textBox->setBehavesLikeText(true); 1442 1442 return textBox; 1443 1443 } -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r155975 r156025 1002 1002 bool RootInlineBox::includeLeadingForBox(InlineBox* box) const 1003 1003 { 1004 if (box->renderer().isReplaced() || (box->renderer().isText () && !box->isText()))1004 if (box->renderer().isReplaced() || (box->renderer().isTextOrBR() && !box->behavesLikeText())) 1005 1005 return false; 1006 1006 … … 1011 1011 bool RootInlineBox::includeFontForBox(InlineBox* box) const 1012 1012 { 1013 if (box->renderer().isReplaced() || (box->renderer().isText () && !box->isText()))1013 if (box->renderer().isReplaced() || (box->renderer().isTextOrBR() && !box->behavesLikeText())) 1014 1014 return false; 1015 1015 1016 if (!box-> isText() && box->isInlineFlowBox() && !toInlineFlowBox(box)->hasTextChildren())1016 if (!box->behavesLikeText() && box->isInlineFlowBox() && !toInlineFlowBox(box)->hasTextChildren()) 1017 1017 return false; 1018 1018 … … 1024 1024 bool RootInlineBox::includeGlyphsForBox(InlineBox* box) const 1025 1025 { 1026 if (box->renderer().isReplaced() || (box->renderer().isText () && !box->isText()))1026 if (box->renderer().isReplaced() || (box->renderer().isTextOrBR() && !box->behavesLikeText())) 1027 1027 return false; 1028 1028 1029 if (!box-> isText() && box->isInlineFlowBox() && !toInlineFlowBox(box)->hasTextChildren())1029 if (!box->behavesLikeText() && box->isInlineFlowBox() && !toInlineFlowBox(box)->hasTextChildren()) 1030 1030 return false; 1031 1031 … … 1037 1037 bool RootInlineBox::includeMarginForBox(InlineBox* box) const 1038 1038 { 1039 if (box->renderer().isReplaced() || (box->renderer().isText () && !box->isText()))1039 if (box->renderer().isReplaced() || (box->renderer().isTextOrBR() && !box->behavesLikeText())) 1040 1040 return false; 1041 1041
Note:
See TracChangeset
for help on using the changeset viewer.