Changeset 156613 in webkit
- Timestamp:
- Sep 28, 2013, 9:34:37 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r156612 r156613 1 2013-09-28 Antti Koivisto <antti@apple.com> 2 3 Switch inline boxes to use const RenderStyle& 4 https://bugs.webkit.org/show_bug.cgi?id=122068 5 6 Reviewed by Sam Weinig. 7 1 8 2013-09-28 Antti Koivisto <antti@apple.com> 2 9 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r151807 r156613 44 44 static bool isNeeded(RenderText* text, const Font& font) 45 45 { 46 TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());46 TextRun run = RenderBlock::constructTextRun(text, font, text, *text->style()); 47 47 return font.codePath(run) == Font::Complex; 48 48 } … … 69 69 static TextRun constructTextRun(RenderText* text, const Font& font, float xPos) 70 70 { 71 TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());71 TextRun run = RenderBlock::constructTextRun(text, font, text, *text->style()); 72 72 run.setCharactersLength(text->textLength()); 73 73 ASSERT(run.charactersLength() >= run.length()); -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r156608 r156613 45 45 { 46 46 GraphicsContext* context = paintInfo.context; 47 RenderStyle& lineStyle = this->lineStyle();47 const RenderStyle& lineStyle = this->lineStyle(); 48 48 Color textColor = lineStyle.visitedDependentColor(CSSPropertyWebkitTextFillColor); 49 49 if (textColor != context->fillColor()) … … 58 58 const Font& font = lineStyle.font(); 59 59 if (selectionState() != RenderObject::SelectionNone) { 60 paintSelection(context, paintOffset, &lineStyle, font);60 paintSelection(context, paintOffset, lineStyle, font); 61 61 62 62 // Select the correct color for painting the text. … … 67 67 68 68 // FIXME: Why is this always LTR? Fix by passing correct text run flags below. 69 context->drawText(font, RenderBlock::constructTextRun(&renderer(), font, m_str, &lineStyle, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));69 context->drawText(font, RenderBlock::constructTextRun(&renderer(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent())); 70 70 71 71 // Restore the regular fill color. … … 76 76 context->clearShadow(); 77 77 78 paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, &lineStyle);78 paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, lineStyle); 79 79 } 80 80 … … 97 97 } 98 98 99 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle*style)99 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle& style) 100 100 { 101 101 InlineBox* markupBox = this->markupBox(); … … 105 105 LayoutPoint adjustedPaintOffset = paintOffset; 106 106 adjustedPaintOffset.move(x() + m_logicalWidth - markupBox->x(), 107 y() + style ->fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent()));107 y() + style.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent())); 108 108 markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom); 109 109 } … … 111 111 IntRect EllipsisBox::selectionRect() 112 112 { 113 RenderStyle& lineStyle = this->lineStyle();113 const RenderStyle& lineStyle = this->lineStyle(); 114 114 const Font& font = lineStyle.font(); 115 115 const RootInlineBox& rootBox = root(); 116 116 // FIXME: Why is this always LTR? Fix by passing correct text run flags below. 117 return enclosingIntRect(font.selectionRectForText(RenderBlock::constructTextRun(&renderer(), font, m_str, &lineStyle, TextRun::AllowTrailingExpansion), IntPoint(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock()), rootBox.selectionHeightAdjustedForPrecedingBlock()));117 return enclosingIntRect(font.selectionRectForText(RenderBlock::constructTextRun(&renderer(), font, m_str, lineStyle, TextRun::AllowTrailingExpansion), IntPoint(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock()), rootBox.selectionHeightAdjustedForPrecedingBlock())); 118 118 } 119 119 120 void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, RenderStyle*style, const Font& font)120 void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, const RenderStyle& style, const Font& font) 121 121 { 122 Color textColor = style ->visitedDependentColor(CSSPropertyColor);122 Color textColor = style.visitedDependentColor(CSSPropertyColor); 123 123 Color c = renderer().selectionBackgroundColor(); 124 124 if (!c.isValid() || !c.alpha()) … … 139 139 context->clip(clipRect); 140 140 // FIXME: Why is this always LTR? Fix by passing correct text run flags below. 141 context->drawHighlightForText(font, RenderBlock::constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style ->colorSpace());141 context->drawHighlightForText(font, RenderBlock::constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion), roundedIntPoint(LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + top)), h, c, style.colorSpace()); 142 142 } 143 143 … … 148 148 // Hit test the markup box. 149 149 if (InlineBox* markupBox = this->markupBox()) { 150 RenderStyle& lineStyle = this->lineStyle();150 const RenderStyle& lineStyle = this->lineStyle(); 151 151 LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x(); 152 152 LayoutUnit mty = adjustedLocation.y() + lineStyle.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent()); -
trunk/Source/WebCore/rendering/EllipsisBox.h
r156095 r156613 40 40 41 41 private: 42 void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle*);42 void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle&); 43 43 virtual int height() const { return m_height; } 44 44 virtual RenderObject::SelectionState selectionState() { return m_selectionState; } 45 void paintSelection(GraphicsContext*, const LayoutPoint&, RenderStyle*, const Font&);45 void paintSelection(GraphicsContext*, const LayoutPoint&, const RenderStyle&, const Font&); 46 46 InlineBox* markupBox() const; 47 47 -
trunk/Source/WebCore/rendering/InlineBox.h
r156608 r156613 281 281 bool visibleToHitTesting() const { return renderer().style()->visibility() == VISIBLE && renderer().style()->pointerEvents() != PE_NONE; } 282 282 283 RenderStyle& lineStyle() const { return m_bitfields.firstLine() ? *renderer().firstLineStyle() : *renderer().style(); }283 const RenderStyle& lineStyle() const { return m_bitfields.firstLine() ? *renderer().firstLineStyle() : *renderer().style(); } 284 284 285 285 EVerticalAlign verticalAlign() const { return lineStyle().verticalAlign(); } -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r156608 r156613 161 161 const RenderStyle& childStyle = child->lineStyle(); 162 162 if (child->behavesLikeText()) { 163 RenderStyle* childStyle = &child->lineStyle();163 const RenderStyle* childStyle = &child->lineStyle(); 164 164 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeWidth()) 165 165 child->clearKnownToHaveNoOverflow(); … … 662 662 LayoutUnit boxHeightIncludingMargins = boxHeight; 663 663 664 RenderStyle& childLineStyle = curr->lineStyle();664 const RenderStyle& childLineStyle = curr->lineStyle(); 665 665 if (curr->behavesLikeText() || curr->isInlineFlowBox()) { 666 666 const FontMetrics& fontMetrics = childLineStyle.fontMetrics(); … … 704 704 if (curr->isInlineTextBox()) { 705 705 TextEmphasisPosition emphasisMarkPosition; 706 if (toInlineTextBox(curr)->getEmphasisMarkPosition( &childLineStyle, emphasisMarkPosition)) {706 if (toInlineTextBox(curr)->getEmphasisMarkPosition(childLineStyle, emphasisMarkPosition)) { 707 707 bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphasisPositionOver; 708 708 if (emphasisMarkIsOver != childLineStyle.isFlippedLinesWritingMode()) … … 859 859 return; 860 860 861 RenderStyle& lineStyle = this->lineStyle();861 const RenderStyle& lineStyle = this->lineStyle(); 862 862 863 863 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox); … … 877 877 878 878 TextEmphasisPosition emphasisMarkPosition; 879 if (lineStyle.textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasisMarkPosition( &lineStyle, emphasisMarkPosition)) {879 if (lineStyle.textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasisMarkPosition(lineStyle, emphasisMarkPosition)) { 880 880 int emphasisMarkHeight = lineStyle.font().emphasisMarkHeight(lineStyle.textEmphasisMarkString()); 881 881 if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!lineStyle.isFlippedLinesWritingMode())) … … 1239 1239 } 1240 1240 1241 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect)1241 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, const RenderStyle& style, ShadowStyle shadowStyle, const LayoutRect& paintRect) 1242 1242 { 1243 1243 if ((!prevLineBox() && !nextLineBox()) || !parent()) 1244 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle);1244 boxModelObject()->paintBoxShadow(info, paintRect, &style, shadowStyle); 1245 1245 else { 1246 1246 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 1247 1247 // protrude incorrectly at the edges, and we want to possibly include shadows cast from the previous/following lines 1248 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includeLogicalLeftEdge(), includeLogicalRightEdge());1248 boxModelObject()->paintBoxShadow(info, paintRect, &style, shadowStyle, includeLogicalLeftEdge(), includeLogicalRightEdge()); 1249 1249 } 1250 1250 } … … 1315 1315 if (parent() && !renderer().hasBoxDecorations()) 1316 1316 return; 1317 RenderStyle& lineStyle = this->lineStyle();1317 const RenderStyle& lineStyle = this->lineStyle(); 1318 1318 if (!parent() && (!isFirstLine() || &lineStyle == renderer().style())) 1319 1319 return; … … 1324 1324 // Shadow comes first and is behind the background and border. 1325 1325 if (!boxModelObject()->boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, this)) 1326 paintBoxShadow(paintInfo, &lineStyle, Normal, paintRect);1326 paintBoxShadow(paintInfo, lineStyle, Normal, paintRect); 1327 1327 1328 1328 Color c = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor); 1329 1329 paintFillLayers(paintInfo, c, lineStyle.backgroundLayers(), paintRect); 1330 paintBoxShadow(paintInfo, &lineStyle, Inset, paintRect);1330 paintBoxShadow(paintInfo, lineStyle, Inset, paintRect); 1331 1331 1332 1332 // :first-line cannot be used to put borders on a line. Always paint borders with our … … 1542 1542 1543 1543 if (curr->isInlineTextBox()) { 1544 RenderStyle& childLineStyle = curr->lineStyle();1544 const RenderStyle& childLineStyle = curr->lineStyle(); 1545 1545 TextEmphasisPosition emphasisMarkPosition; 1546 if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && toInlineTextBox(curr)->getEmphasisMarkPosition( &childLineStyle, emphasisMarkPosition) && emphasisMarkPosition == TextEmphasisPositionOver) {1546 if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && toInlineTextBox(curr)->getEmphasisMarkPosition(childLineStyle, emphasisMarkPosition) && emphasisMarkPosition == TextEmphasisPositionOver) { 1547 1547 if (!childLineStyle.isFlippedLinesWritingMode()) { 1548 1548 int topOfEmphasisMark = curr->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString()); … … 1590 1590 1591 1591 if (curr->isInlineTextBox()) { 1592 RenderStyle& childLineStyle = curr->lineStyle();1592 const RenderStyle& childLineStyle = curr->lineStyle(); 1593 1593 if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && childLineStyle.textEmphasisPosition() == TextEmphasisPositionUnder) { 1594 1594 if (!childLineStyle.isFlippedLinesWritingMode()) { -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r156608 r156613 74 74 75 75 RenderBoxModelObject& renderer() const { return toRenderBoxModelObject(InlineBox::renderer()); } 76 RenderStyle& lineStyle() const { return isFirstLine() ? *renderer().firstLineStyle() : *renderer().style(); }76 const RenderStyle& lineStyle() const { return isFirstLine() ? *renderer().firstLineStyle() : *renderer().style(); } 77 77 78 78 InlineFlowBox* prevLineBox() const { return m_prevLineBox; } … … 117 117 void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver); 118 118 void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver); 119 void paintBoxShadow(const PaintInfo&, RenderStyle*, ShadowStyle, const LayoutRect&);119 void paintBoxShadow(const PaintInfo&, const RenderStyle&, ShadowStyle, const LayoutRect&); 120 120 virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom); 121 121 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) OVERRIDE; -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r156608 r156613 180 180 } 181 181 182 static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, RenderStyle*style, String& string, int& length)183 { 184 const AtomicString& hyphenString = style ->hyphenString();182 static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, const RenderStyle& style, String& string, int& length) 183 { 184 const AtomicString& hyphenString = style.hyphenString(); 185 185 charactersWithHyphen.reserveCapacity(length + hyphenString.length()); 186 186 charactersWithHyphen.append(string); … … 212 212 LayoutUnit selTop = selectionTop(); 213 213 LayoutUnit selHeight = selectionHeight(); 214 RenderStyle& lineStyle = this->lineStyle();214 const RenderStyle& lineStyle = this->lineStyle(); 215 215 const Font& font = fontToUse(lineStyle, renderer()); 216 216 217 217 BufferForAppendingHyphen charactersWithHyphen; 218 218 bool respectHyphen = ePos == m_len && hasHyphen(); 219 TextRun textRun = constructTextRun( &lineStyle, font, respectHyphen ? &charactersWithHyphen : 0);219 TextRun textRun = constructTextRun(lineStyle, font, respectHyphen ? &charactersWithHyphen : 0); 220 220 if (respectHyphen) 221 221 endPos = textRun.length(); … … 486 486 } 487 487 488 bool InlineTextBox::getEmphasisMarkPosition( RenderStyle*style, TextEmphasisPosition& emphasisPosition) const488 bool InlineTextBox::getEmphasisMarkPosition(const RenderStyle& style, TextEmphasisPosition& emphasisPosition) const 489 489 { 490 490 // This function returns true if there are text emphasis marks and they are suppressed by ruby text. 491 if (style ->textEmphasisMark() == TextEmphasisMarkNone)491 if (style.textEmphasisMark() == TextEmphasisMarkNone) 492 492 return false; 493 493 494 emphasisPosition = style ->textEmphasisPosition();494 emphasisPosition = style.textEmphasisPosition(); 495 495 if (emphasisPosition == TextEmphasisPositionUnder) 496 496 return true; // Ruby text is always over, so it cannot suppress emphasis marks under. … … 565 565 GraphicsContext* context = paintInfo.context; 566 566 567 RenderStyle& lineStyle = this->lineStyle();567 const RenderStyle& lineStyle = this->lineStyle(); 568 568 569 569 adjustedPaintOffset.move(0, lineStyle.isHorizontalWritingMode() ? 0 : -logicalHeight()); … … 688 688 689 689 if (containsComposition && !useCustomUnderlines) 690 paintCompositionBackground(context, boxOrigin, &lineStyle, font,690 paintCompositionBackground(context, boxOrigin, lineStyle, font, 691 691 renderer().frame().editor().compositionStart(), 692 692 renderer().frame().editor().compositionEnd()); 693 693 694 paintDocumentMarkers(context, boxOrigin, &lineStyle, font, true);694 paintDocumentMarkers(context, boxOrigin, lineStyle, font, true); 695 695 696 696 if (haveSelection && !useCustomUnderlines) 697 paintSelection(context, boxOrigin, &lineStyle, font, selectionFillColor);697 paintSelection(context, boxOrigin, lineStyle, font, selectionFillColor); 698 698 } 699 699 … … 724 724 725 725 BufferForAppendingHyphen charactersWithHyphen; 726 TextRun textRun = constructTextRun( &lineStyle, font, string, maximumLength, hasHyphen() ? &charactersWithHyphen : 0);726 TextRun textRun = constructTextRun(lineStyle, font, string, maximumLength, hasHyphen() ? &charactersWithHyphen : 0); 727 727 if (hasHyphen()) 728 728 length = textRun.length(); … … 741 741 int emphasisMarkOffset = 0; 742 742 TextEmphasisPosition emphasisMarkPosition; 743 bool hasTextEmphasis = getEmphasisMarkPosition( &lineStyle, emphasisMarkPosition);743 bool hasTextEmphasis = getEmphasisMarkPosition(lineStyle, emphasisMarkPosition); 744 744 const AtomicString& emphasisMark = hasTextEmphasis ? lineStyle.textEmphasisMarkString() : nullAtom; 745 745 if (!emphasisMark.isEmpty()) … … 812 812 813 813 if (paintInfo.phase == PaintPhaseForeground) { 814 paintDocumentMarkers(context, boxOrigin, &lineStyle, font, false);814 paintDocumentMarkers(context, boxOrigin, lineStyle, font, false); 815 815 816 816 if (useCustomUnderlines) { … … 869 869 } 870 870 871 void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& boxOrigin, RenderStyle*style, const Font& font, Color textColor)871 void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, Color textColor) 872 872 { 873 873 if (context->paintingDisabled()) … … 890 890 891 891 GraphicsContextStateSaver stateSaver(*context); 892 updateGraphicsContext(context, c, c, 0, style ->colorSpace());// Don't draw text at all!892 updateGraphicsContext(context, c, c, 0, style.colorSpace()); // Don't draw text at all! 893 893 894 894 // If the text is truncated, let the thing being painted in the truncation … … 921 921 context->clip(clipRect); 922 922 923 context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style ->colorSpace(), sPos, ePos);924 } 925 926 void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const FloatPoint& boxOrigin, RenderStyle*style, const Font& font, int startPos, int endPos)923 context->drawHighlightForText(font, textRun, localOrigin, selHeight, c, style.colorSpace(), sPos, ePos); 924 } 925 926 void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, int startPos, int endPos) 927 927 { 928 928 int offset = m_start; … … 937 937 Color c = Color(225, 221, 85); 938 938 939 updateGraphicsContext(context, c, c, 0, style ->colorSpace()); // Don't draw text at all!939 updateGraphicsContext(context, c, c, 0, style.colorSpace()); // Don't draw text at all! 940 940 941 941 int deltaY = renderer().style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop(); 942 942 int selHeight = selectionHeight(); 943 943 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 944 context->drawHighlightForText(font, constructTextRun(style, font), localOrigin, selHeight, c, style ->colorSpace(), sPos, ePos);944 context->drawHighlightForText(font, constructTextRun(style, font), localOrigin, selHeight, c, style.colorSpace(), sPos, ePos); 945 945 } 946 946 … … 1168 1168 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || underline.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.alpha() == 255) && (!(deco & TextDecorationLineThrough) || linethrough.alpha() == 255); 1169 1169 1170 RenderStyle& lineStyle = this->lineStyle();1170 const RenderStyle& lineStyle = this->lineStyle(); 1171 1171 int baseline = lineStyle.fontMetrics().ascent(); 1172 1172 … … 1301 1301 } 1302 1302 1303 void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle*style, const Font& font, bool grammar)1303 void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, const RenderStyle& style, const Font& font, bool grammar) 1304 1304 { 1305 1305 // Never print spelling/grammar markers (5327887) … … 1370 1370 } 1371 1371 1372 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle*style, const Font& font)1372 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, const RenderStyle& style, const Font& font) 1373 1373 { 1374 1374 // Use same y positioning and height as for selection, so that when the selection and this highlight are on … … 1392 1392 renderer().theme()->platformInactiveTextSearchHighlightColor(); 1393 1393 GraphicsContextStateSaver stateSaver(*pt); 1394 updateGraphicsContext(pt, color, color, 0, style ->colorSpace());// Don't draw text at all!1394 updateGraphicsContext(pt, color, color, 0, style.colorSpace()); // Don't draw text at all! 1395 1395 pt->clip(FloatRect(boxOrigin.x(), boxOrigin.y() - deltaY, m_logicalWidth, selHeight)); 1396 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.y() - deltaY), selHeight, color, style ->colorSpace(), sPos, ePos);1397 } 1398 } 1399 1400 void InlineTextBox::computeRectForReplacementMarker(DocumentMarker* marker, RenderStyle*style, const Font& font)1396 pt->drawHighlightForText(font, run, FloatPoint(boxOrigin.x(), boxOrigin.y() - deltaY), selHeight, color, style.colorSpace(), sPos, ePos); 1397 } 1398 } 1399 1400 void InlineTextBox::computeRectForReplacementMarker(DocumentMarker* marker, const RenderStyle& style, const Font& font) 1401 1401 { 1402 1402 // Replacement markers are not actually drawn, but their rects need to be computed for hit testing. … … 1415 1415 } 1416 1416 1417 void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const FloatPoint& boxOrigin, RenderStyle*style, const Font& font, bool background)1417 void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, bool background) 1418 1418 { 1419 1419 if (!renderer().textNode()) … … 1554 1554 FontCachePurgePreventer fontCachePurgePreventer; 1555 1555 1556 RenderStyle& lineStyle = this->lineStyle();1556 const RenderStyle& lineStyle = this->lineStyle(); 1557 1557 const Font& font = fontToUse(lineStyle, renderer()); 1558 return font.offsetForPosition(constructTextRun( &lineStyle, font), lineOffset - logicalLeft(), includePartialGlyphs);1558 return font.offsetForPosition(constructTextRun(lineStyle, font), lineOffset - logicalLeft(), includePartialGlyphs); 1559 1559 } 1560 1560 … … 1569 1569 FontCachePurgePreventer fontCachePurgePreventer; 1570 1570 1571 RenderStyle& lineStyle = this->lineStyle();1571 const RenderStyle& lineStyle = this->lineStyle(); 1572 1572 const Font& font = fontToUse(lineStyle, renderer()); 1573 1573 int from = !isLeftToRightDirection() ? offset - m_start : 0; 1574 1574 int to = !isLeftToRightDirection() ? m_len : offset - m_start; 1575 1575 // FIXME: Do we need to add rightBearing here? 1576 return font.selectionRectForText(constructTextRun( &lineStyle, font), IntPoint(logicalLeft(), 0), 0, from, to).maxX();1576 return font.selectionRectForText(constructTextRun(lineStyle, font), IntPoint(logicalLeft(), 0), 0, from, to).maxX(); 1577 1577 } 1578 1578 … … 1601 1601 } 1602 1602 1603 TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, BufferForAppendingHyphen* charactersWithHyphen) const 1604 { 1605 ASSERT(style); 1603 TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& font, BufferForAppendingHyphen* charactersWithHyphen) const 1604 { 1606 1605 ASSERT(renderer().text()); 1607 1606 … … 1616 1615 } 1617 1616 1618 TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, String string, int maximumLength, BufferForAppendingHyphen* charactersWithHyphen) const 1619 { 1620 ASSERT(style); 1621 1617 TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& font, String string, int maximumLength, BufferForAppendingHyphen* charactersWithHyphen) const 1618 { 1622 1619 int length = string.length(); 1623 1620 … … 1629 1626 ASSERT(maximumLength >= length); 1630 1627 1631 TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style ->rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath());1632 run.setTabSize(!style ->collapseWhiteSpace(), style->tabSize());1628 TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath()); 1629 run.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); 1633 1630 if (textRunNeedsRenderingContext(font)) 1634 1631 run.setRenderingContext(SVGTextRunRenderingContext::create(&renderer())); -
trunk/Source/WebCore/rendering/InlineTextBox.h
r156608 r156613 59 59 60 60 RenderText& renderer() const { return toRenderText(InlineBox::renderer()); } 61 RenderStyle& lineStyle() const { return isFirstLine() ? *renderer().firstLineStyle() : *renderer().style(); }61 const RenderStyle& lineStyle() const { return isFirstLine() ? *renderer().firstLineStyle() : *renderer().style(); } 62 62 63 63 virtual void destroy(RenderArena&) OVERRIDE FINAL; … … 92 92 virtual LayoutUnit lineHeight() const OVERRIDE FINAL; 93 93 94 bool getEmphasisMarkPosition( RenderStyle*, TextEmphasisPosition&) const;94 bool getEmphasisMarkPosition(const RenderStyle&, TextEmphasisPosition&) const; 95 95 96 96 LayoutRect logicalOverflowRect() const; … … 111 111 LayoutUnit selectionHeight(); 112 112 113 TextRun constructTextRun( RenderStyle*, const Font&, BufferForAppendingHyphen* = 0) const;114 TextRun constructTextRun( RenderStyle*, const Font&, String, int maximumLength, BufferForAppendingHyphen* = 0) const;113 TextRun constructTextRun(const RenderStyle&, const Font&, BufferForAppendingHyphen* = 0) const; 114 TextRun constructTextRun(const RenderStyle&, const Font&, String, int maximumLength, BufferForAppendingHyphen* = 0) const; 115 115 116 116 public: … … 177 177 178 178 protected: 179 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, int startPos, int endPos);180 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, bool background);179 void paintCompositionBackground(GraphicsContext*, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, int startPos, int endPos); 180 void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, bool background); 181 181 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&); 182 182 #if PLATFORM(MAC) … … 186 186 private: 187 187 void paintDecoration(GraphicsContext*, const FloatPoint& boxOrigin, TextDecoration, TextDecorationStyle, const ShadowData*); 188 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, Color textColor);189 void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&, bool grammar);190 void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, RenderStyle*, const Font&);191 void computeRectForReplacementMarker(DocumentMarker*, RenderStyle*, const Font&);188 void paintSelection(GraphicsContext*, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, Color textColor); 189 void paintDocumentMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, const RenderStyle&, const Font&, bool grammar); 190 void paintTextMatchMarker(GraphicsContext*, const FloatPoint& boxOrigin, DocumentMarker*, const RenderStyle&, const Font&); 191 void computeRectForReplacementMarker(DocumentMarker*, const RenderStyle&, const Font&); 192 192 193 193 TextRun::ExpansionBehavior expansionBehavior() const -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r156608 r156613 5164 5164 const UChar space = ' '; 5165 5165 const Font& font = t->style()->font(); // FIXME: This ignores first-line. 5166 float spaceWidth = font.width(RenderBlock::constructTextRun(t, font, &space, 1, t->style()));5166 float spaceWidth = font.width(RenderBlock::constructTextRun(t, font, &space, 1, *t->style())); 5167 5167 inlineMax -= spaceWidth + font.wordSpacing(); 5168 5168 if (inlineMin > inlineMax) … … 6725 6725 6726 6726 template <typename CharacterType> 6727 static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion) 6728 { 6729 ASSERT(style); 6730 6727 static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion) 6728 { 6731 6729 TextDirection textDirection = LTR; 6732 bool directionalOverride = style ->rtlOrdering() == VisualOrder;6730 bool directionalOverride = style.rtlOrdering() == VisualOrder; 6733 6731 6734 6732 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride); … … 6740 6738 6741 6739 template <typename CharacterType> 6742 static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags) 6743 { 6744 ASSERT(style); 6745 6740 static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags) 6741 { 6746 6742 TextDirection textDirection = LTR; 6747 bool directionalOverride = style ->rtlOrdering() == VisualOrder;6743 bool directionalOverride = style.rtlOrdering() == VisualOrder; 6748 6744 if (flags != DefaultTextRunFlags) { 6749 6745 if (flags & RespectDirection) 6750 textDirection = style ->direction();6746 textDirection = style.direction(); 6751 6747 if (flags & RespectDirectionOverride) 6752 directionalOverride |= isOverride(style ->unicodeBidi());6748 directionalOverride |= isOverride(style.unicodeBidi()); 6753 6749 } 6754 6750 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride); … … 6760 6756 6761 6757 #if ENABLE(8BIT_TEXTRUN) 6762 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle*style, TextRun::ExpansionBehavior expansion)6758 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion) 6763 6759 { 6764 6760 return constructTextRunInternal(context, font, characters, length, style, expansion); … … 6766 6762 #endif 6767 6763 6768 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle*style, TextRun::ExpansionBehavior expansion)6764 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion) 6769 6765 { 6770 6766 return constructTextRunInternal(context, font, characters, length, style, expansion); 6771 6767 } 6772 6768 6773 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, RenderStyle*style, TextRun::ExpansionBehavior expansion)6769 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, const RenderStyle& style, TextRun::ExpansionBehavior expansion) 6774 6770 { 6775 6771 #if ENABLE(8BIT_TEXTRUN) … … 6782 6778 } 6783 6779 6784 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle*style, TextRun::ExpansionBehavior expansion)6780 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, const RenderStyle& style, TextRun::ExpansionBehavior expansion) 6785 6781 { 6786 6782 ASSERT(offset + length <= text->textLength()); … … 6794 6790 } 6795 6791 6796 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle*style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)6792 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags) 6797 6793 { 6798 6794 unsigned length = string.length(); -
trunk/Source/WebCore/rendering/RenderBlock.h
r156557 r156613 298 298 static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&); 299 299 300 static TextRun constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle* style,300 static TextRun constructTextRun(RenderObject* context, const Font&, const String&, const RenderStyle&, 301 301 TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, TextRunFlags = DefaultTextRunFlags); 302 302 303 static TextRun constructTextRun(RenderObject* context, const Font& font, const RenderText* text, RenderStyle* style,303 static TextRun constructTextRun(RenderObject* context, const Font&, const RenderText*, const RenderStyle&, 304 304 TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion); 305 305 306 static TextRun constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style,306 static TextRun constructTextRun(RenderObject* context, const Font&, const RenderText*, unsigned offset, unsigned length, const RenderStyle&, 307 307 TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion); 308 308 309 static TextRun constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, RenderStyle* style,309 static TextRun constructTextRun(RenderObject* context, const Font&, const RenderText*, unsigned offset, const RenderStyle&, 310 310 TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion); 311 311 312 312 #if ENABLE(8BIT_TEXTRUN) 313 static TextRun constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle* style,313 static TextRun constructTextRun(RenderObject* context, const Font&, const LChar* characters, int length, const RenderStyle&, 314 314 TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion); 315 315 #endif 316 316 317 static TextRun constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style,317 static TextRun constructTextRun(RenderObject* context, const Font&, const UChar* characters, int length, const RenderStyle&, 318 318 TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion); 319 319 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r156608 r156613 602 602 static inline float measureHyphenWidth(RenderText* renderer, const Font& font, HashSet<const SimpleFontData*>* fallbackFonts = 0) 603 603 { 604 RenderStyle* style =renderer->style();605 return font.width(RenderBlock::constructTextRun(renderer, font, style ->hyphenString().string(), style), fallbackFonts);604 const RenderStyle& style = *renderer->style(); 605 return font.width(RenderBlock::constructTextRun(renderer, font, style.hyphenString().string(), style), fallbackFonts); 606 606 } 607 607 … … 623 623 }; 624 624 625 static inline RenderStyle& lineStyle(RenderElement& renderer, const LineInfo& lineInfo)625 static inline const RenderStyle& lineStyle(RenderElement& renderer, const LineInfo& lineInfo) 626 626 { 627 627 return lineInfo.isFirstLine() ? *renderer.firstLineStyle() : *renderer.style(); … … 791 791 } 792 792 793 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, RenderStyle*style)793 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, const RenderStyle& style) 794 794 { 795 795 IndentTextOrNot shouldIndentText = DoNotIndentText; … … 828 828 bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent()->firstChild() != this); 829 829 bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()->endsWithBreak(); 830 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLineBreak, style());830 IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLineBreak, *style()); 831 831 float lineLogicalLeft; 832 832 float lineLogicalRight; … … 2351 2351 static ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, const Font& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const SimpleFontData*>& fallbackFonts, TextLayout* layout = 0) 2352 2352 { 2353 const RenderStyle& style = *text->style(); 2354 2353 2355 GlyphOverflow glyphOverflow; 2354 if (isFixedPitch || (!from && len == text->textLength()) || text->style()->hasTextCombine())2356 if (isFixedPitch || (!from && len == text->textLength()) || style.hasTextCombine()) 2355 2357 return text->width(from, len, font, xPos, &fallbackFonts, &glyphOverflow); 2356 2358 … … 2358 2360 return Font::width(*layout, from, len, &fallbackFonts); 2359 2361 2360 TextRun run = RenderBlock::constructTextRun(text, font, text, from, len, text->style());2362 TextRun run = RenderBlock::constructTextRun(text, font, text, from, len, style); 2361 2363 run.setCharactersLength(text->textLength() - from); 2362 2364 ASSERT(run.charactersLength() >= run.length()); … … 2398 2400 return; 2399 2401 2400 TextRun run = RenderBlock::constructTextRun(text, font, text, lastSpace, pos - lastSpace, text->style()); 2402 const RenderStyle& style = *text->style(); 2403 TextRun run = RenderBlock::constructTextRun(text, font, text, lastSpace, pos - lastSpace, style); 2401 2404 run.setCharactersLength(text->textLength() - lastSpace); 2402 2405 ASSERT(run.charactersLength() >= run.length()); 2403 2406 2404 run.setTabSize(!collapseWhiteSpace, text->style()->tabSize());2407 run.setTabSize(!collapseWhiteSpace, style.tabSize()); 2405 2408 run.setXPos(xPos + lastSpaceWordSpacing); 2406 2409 … … 2683 2686 LineMidpointState& lineMidpointState = resolver.midpointState(); 2684 2687 2685 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.isFirstLine(), lineInfo.previousLineBrokeCleanly(), m_block->style()));2688 LineWidth width(*m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.isFirstLine(), lineInfo.previousLineBrokeCleanly(), *m_block->style())); 2686 2689 2687 2690 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); … … 2719 2722 // very specific circumstances (in order to match common WinIE renderings). 2720 2723 // Not supporting the quirk has caused us to mis-render some real sites. (See Bugzilla 10517.) 2721 RenderStyle* blockStyle =m_block->style();2722 bool allowImagesToBreak = !m_block->document().inQuirksMode() || !m_block->isTableCell() || !blockStyle ->logicalWidth().isIntrinsicOrAuto();2723 2724 EWhiteSpace currWS = blockStyle ->whiteSpace();2724 const RenderStyle& blockStyle = *m_block->style(); 2725 bool allowImagesToBreak = !m_block->document().inQuirksMode() || !m_block->isTableCell() || !blockStyle.logicalWidth().isIntrinsicOrAuto(); 2726 2727 EWhiteSpace currWS = blockStyle.whiteSpace(); 2725 2728 EWhiteSpace lastWS = currWS; 2726 2729 while (current.m_obj) { 2727 RenderStyle* currentStyle =current.m_obj->style();2730 const RenderStyle& currentStyle = *current.m_obj->style(); 2728 2731 RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj); 2729 2732 if (next && next->parent() && !next->parent()->isDescendantOf(current.m_obj->parent())) 2730 2733 includeEndWidth = true; 2731 2734 2732 currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()->whiteSpace() : currentStyle ->whiteSpace();2735 currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()->whiteSpace() : currentStyle.whiteSpace(); 2733 2736 lastWS = last->isReplaced() ? last->parent()->style()->whiteSpace() : last->style()->whiteSpace(); 2734 2737 … … 2762 2765 // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a 2763 2766 // run for this object. 2764 if (ignoringSpaces && currentStyle ->clear() != CNONE)2767 if (ignoringSpaces && currentStyle.clear() != CNONE) 2765 2768 ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj); 2766 2769 // If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets 2767 2770 // collapsed away so that it doesn't push the text out from the container's right-hand edge. 2768 2771 // FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results. 2769 else if (ignoringSpaces && (blockStyle ->textAlign() == RIGHT || blockStyle->textAlign() == WEBKIT_RIGHT))2772 else if (ignoringSpaces && (blockStyle.textAlign() == RIGHT || blockStyle.textAlign() == WEBKIT_RIGHT)) 2770 2773 stopIgnoringSpaces(lineMidpointState, InlineIterator(0, current.m_obj, current.m_pos)); 2771 2774 2772 2775 if (!lineInfo.isEmpty()) 2773 m_clear = currentStyle ->clear();2776 m_clear = currentStyle.clear(); 2774 2777 } 2775 2778 goto end; … … 2836 2839 trailingObjects.clear(); 2837 2840 ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj); 2838 } else if (blockStyle ->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj2841 } else if (blockStyle.collapseWhiteSpace() && resolver.position().m_obj == current.m_obj 2839 2842 && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) { 2840 2843 // Like with list markers, we start ignoring spaces to make sure that any … … 2872 2875 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replacedBox) + inlineLogicalWidth(current.m_obj); 2873 2876 if (current.m_obj->isListMarker()) { 2874 if (blockStyle ->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {2877 if (blockStyle.collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) { 2875 2878 // Like with inline flows, we start ignoring spaces to make sure that any 2876 2879 // additional spaces we see will be discarded. … … 2913 2916 } 2914 2917 2915 RenderStyle& style = lineStyle(*t->parent(), lineInfo);2918 const RenderStyle& style = lineStyle(*t->parent(), lineInfo); 2916 2919 const Font& f = style.font(); 2917 2920 bool isFixedPitch = f.isFixedPitch(); … … 2919 2922 2920 2923 unsigned lastSpace = current.m_pos; 2921 float wordSpacing = currentStyle ->wordSpacing();2924 float wordSpacing = currentStyle.wordSpacing(); 2922 2925 float lastSpaceWordSpacing = 0; 2923 2926 float wordSpacingForWordMeasurement = 0; … … 2925 2928 float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true); 2926 2929 float charWidth = 0; 2927 bool breakNBSP = autoWrap && currentStyle ->nbspMode() == SPACE;2930 bool breakNBSP = autoWrap && currentStyle.nbspMode() == SPACE; 2928 2931 // Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word, 2929 2932 // which is only possible if the word is the first thing on the line, that is, if |w| is zero. 2930 bool breakWords = currentStyle ->breakWords() && ((autoWrap && !width.committedWidth()) || currWS == PRE);2933 bool breakWords = currentStyle.breakWords() && ((autoWrap && !width.committedWidth()) || currWS == PRE); 2931 2934 bool midWordBreak = false; 2932 bool breakAll = currentStyle ->wordBreak() == BreakAllWordBreak && autoWrap;2935 bool breakAll = currentStyle.wordBreak() == BreakAllWordBreak && autoWrap; 2933 2936 float hyphenWidth = 0; 2934 2937 #if ENABLE(SVG) … … 2955 2958 // words with their trailing space, then subtract its width. 2956 2959 HashSet<const SimpleFontData*> fallbackFonts; 2957 float wordTrailingSpaceWidth = (f.typesettingFeatures() & Kerning) && !textLayout ? f.width(RenderBlock::constructTextRun(t, f, &space, 1, &style), &fallbackFonts) + wordSpacing : 0;2960 float wordTrailingSpaceWidth = (f.typesettingFeatures() & Kerning) && !textLayout ? f.width(RenderBlock::constructTextRun(t, f, &space, 1, style), &fallbackFonts) + wordSpacing : 0; 2958 2961 2959 2962 UChar lastCharacter = renderTextInfo.m_lineBreakIterator.lastCharacter(); … … 3047 3050 // as candidate width for this line. 3048 3051 bool lineWasTooWide = false; 3049 if (width.fitsOnLine() && currentCharacterIsWS && currentStyle ->breakOnlyAfterWhiteSpace() && !midWordBreak) {3052 if (width.fitsOnLine() && currentCharacterIsWS && currentStyle.breakOnlyAfterWhiteSpace() && !midWordBreak) { 3050 3053 float charWidth = textWidth(t, current.m_pos, 1, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0); 3051 3054 // Check if line is too big even without the extra space … … 3062 3065 if (lineWasTooWide || !width.fitsOnLine()) { 3063 3066 if (canHyphenate && !width.fitsOnLine()) { 3064 tryHyphenating(t, f, style.locale(), consecutiveHyphenatedLines, blockStyle ->hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTempWidth, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);3067 tryHyphenating(t, f, style.locale(), consecutiveHyphenatedLines, blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTempWidth, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated); 3065 3068 if (m_hyphenated) 3066 3069 goto end; … … 3125 3128 } 3126 3129 3127 if (!ignoringSpaces && currentStyle ->collapseWhiteSpace()) {3130 if (!ignoringSpaces && currentStyle.collapseWhiteSpace()) { 3128 3131 // If we encounter a newline, or if we encounter a 3129 3132 // second space, we need to go ahead and break up this … … 3163 3166 // space doesn't seem to push the text out from the right-hand edge. 3164 3167 // FIXME: Do this regardless of the container's alignment - will require rebaselining a lot of test results. 3165 if (next && next->isBR() && (blockStyle ->textAlign() == RIGHT || blockStyle->textAlign() == WEBKIT_RIGHT)) {3168 if (next && next->isBR() && (blockStyle.textAlign() == RIGHT || blockStyle.textAlign() == WEBKIT_RIGHT)) { 3166 3169 ignoreStart.m_pos--; 3167 3170 // If there's just a single trailing space start ignoring it now so it collapses away. … … 3172 3175 3173 3176 if (!currentCharacterIsWS && previousCharacterIsWS) { 3174 if (autoWrap && currentStyle ->breakOnlyAfterWhiteSpace())3177 if (autoWrap && currentStyle.breakOnlyAfterWhiteSpace()) 3175 3178 lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition); 3176 3179 } … … 3178 3181 if (collapseWhiteSpace && currentCharacterIsSpace && !ignoringSpaces) 3179 3182 trailingObjects.setTrailingWhitespace(toRenderText(current.m_obj)); 3180 else if (!currentStyle ->collapseWhiteSpace() || !currentCharacterIsSpace)3183 else if (!currentStyle.collapseWhiteSpace() || !currentCharacterIsSpace) 3181 3184 trailingObjects.clear(); 3182 3185 … … 3214 3217 if (!width.fitsOnLine()) { 3215 3218 if (canHyphenate) 3216 tryHyphenating(t, f, style.locale(), consecutiveHyphenatedLines, blockStyle ->hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTempWidth, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);3219 tryHyphenating(t, f, style.locale(), consecutiveHyphenatedLines, blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTempWidth, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated); 3217 3220 3218 3221 if (!m_hyphenated && lBreak.previousInSameNode() == softHyphen && style.hyphens() != HyphensNone) … … 3230 3233 if (canBreakHere && !width.fitsOnLine(ignoringSpaces)) { 3231 3234 // if we have floats, try to get below them. 3232 if (currentCharacterIsSpace && !ignoringSpaces && currentStyle ->collapseWhiteSpace())3235 if (currentCharacterIsSpace && !ignoringSpaces && currentStyle.collapseWhiteSpace()) 3233 3236 trailingObjects.clear(); 3234 3237 … … 3243 3246 if (!width.fitsOnLine(ignoringSpaces)) 3244 3247 goto end; 3245 } else if (blockStyle ->autoWrap() && !width.fitsOnLine() && !width.committedWidth()) {3248 } else if (blockStyle.autoWrap() && !width.fitsOnLine() && !width.committedWidth()) { 3246 3249 // If the container autowraps but the current child does not then we still need to ensure that it 3247 3250 // wraps and moves below any floats. … … 3279 3282 if (!lBreak.m_obj || !lBreak.m_obj->isBR()) { 3280 3283 // we just add as much as possible 3281 if (blockStyle ->whiteSpace() == PRE && !current.m_pos) {3284 if (blockStyle.whiteSpace() == PRE && !current.m_pos) { 3282 3285 lBreak.moveTo(last, last->isText() ? last->length() : 0); 3283 3286 } else if (lBreak.m_obj) { … … 3367 3370 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1)); 3368 3371 const Font& firstLineFont = firstLineStyle()->font(); 3369 int firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, &horizontalEllipsis, 1, firstLineStyle()));3370 int ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style()));3372 int firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, &horizontalEllipsis, 1, *firstLineStyle())); 3373 int ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(constructTextRun(this, font, &horizontalEllipsis, 1, *style())); 3371 3374 3372 3375 // For LTR text truncation, we want to get the right edge of our padding box, and then we want to see -
trunk/Source/WebCore/rendering/RenderCombineText.cpp
r156500 r156613 101 101 return; 102 102 103 TextRun run = RenderBlock::constructTextRun(this, originalFont(), this, style());103 TextRun run = RenderBlock::constructTextRun(this, originalFont(), this, *style()); 104 104 FontDescription description = originalFont().fontDescription(); 105 105 float emWidth = description.computedSize() * textCombineMargin; -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r156608 r156613 1016 1016 InlineBox* anchorBox = lastLine->lastChild(); 1017 1017 if (anchorBox && anchorBox->renderer().style()->isLink()) 1018 totalWidth = anchorBox->logicalWidth() + font.width(constructTextRun(this, font, ellipsisAndSpace, 2, style()));1018 totalWidth = anchorBox->logicalWidth() + font.width(constructTextRun(this, font, ellipsisAndSpace, 2, *style())); 1019 1019 else { 1020 1020 anchorBox = 0; 1021 totalWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style()));1021 totalWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, *style())); 1022 1022 } 1023 1023 -
trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp
r156155 r156613 121 121 const String& displayedFilename = fileTextValue(); 122 122 const Font& font = style()->font(); 123 TextRun textRun = constructTextRun(this, font, displayedFilename, style(), TextRun::AllowTrailingExpansion, RespectDirection | RespectDirectionOverride);123 TextRun textRun = constructTextRun(this, font, displayedFilename, *style(), TextRun::AllowTrailingExpansion, RespectDirection | RespectDirectionOverride); 124 124 textRun.disableRoundingHacks(); 125 125 … … 179 179 // FIXME: Remove the need for this const_cast by making constructTextRun take a const RenderObject*. 180 180 RenderFileUploadControl* renderer = const_cast<RenderFileUploadControl*>(this); 181 float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(renderer, font, characterAsString, style(), TextRun::AllowTrailingExpansion));181 float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(renderer, font, characterAsString, *style(), TextRun::AllowTrailingExpansion)); 182 182 183 183 const String label = theme()->fileListDefaultLabel(inputElement().multiple()); 184 float defaultLabelWidth = font.width(constructTextRun(renderer, font, label, style(), TextRun::AllowTrailingExpansion));184 float defaultLabelWidth = font.width(constructTextRun(renderer, font, label, *style(), TextRun::AllowTrailingExpansion)); 185 185 if (HTMLInputElement* button = uploadButton()) 186 186 if (RenderObject* buttonRenderer = button->renderer()) -
trunk/Source/WebCore/rendering/RenderImage.cpp
r155908 r156613 128 128 129 129 const Font& font = style()->font(); 130 IntSize paddedTextSize(paddingWidth + min(ceilf(font.width(RenderBlock::constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), paddingHeight + min(font.fontMetrics().height(), maxAltTextHeight));130 IntSize paddedTextSize(paddingWidth + min(ceilf(font.width(RenderBlock::constructTextRun(this, font, m_altText, *style()))), maxAltTextWidth), paddingHeight + min(font.fontMetrics().height(), maxAltTextHeight)); 131 131 imageSize = imageSize.expandedTo(paddedTextSize); 132 132 } … … 393 393 // Only draw the alt text if it'll fit within the content box, 394 394 // and only if it fits above the error image. 395 TextRun textRun = RenderBlock::constructTextRun(this, font, text, style());395 TextRun textRun = RenderBlock::constructTextRun(this, font, text, *style()); 396 396 LayoutUnit textWidth = font.width(textRun); 397 397 if (errorPictureDrawn) { -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r156558 r156613 131 131 applyTextTransform(style(), text, ' '); 132 132 // FIXME: Why is this always LTR? Can't text direction affect the width? 133 TextRun textRun = constructTextRun(this, itemFont, text, style(), TextRun::AllowTrailingExpansion);133 TextRun textRun = constructTextRun(this, itemFont, text, *style(), TextRun::AllowTrailingExpansion); 134 134 textRun.disableRoundingHacks(); 135 135 float textWidth = itemFont.width(textRun); -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r156025 r156613 1338 1338 1339 1339 const Font& font = style()->font(); 1340 TextRun textRun = RenderBlock::constructTextRun(this, font, m_text, style());1340 TextRun textRun = RenderBlock::constructTextRun(this, font, m_text, *style()); 1341 1341 1342 1342 GraphicsContextStateSaver stateSaver(*context, false); … … 1373 1373 context->drawText(font, textRun, textOrigin); 1374 1374 UChar suffixSpace[2] = { suffix, ' ' }; 1375 context->drawText(font, RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()), textOrigin + IntSize(width, 0));1375 context->drawText(font, RenderBlock::constructTextRun(this, font, suffixSpace, 2, *style()), textOrigin + IntSize(width, 0)); 1376 1376 } else { 1377 1377 UChar spaceSuffix[2] = { ' ', suffix }; 1378 TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, style());1378 TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, *style()); 1379 1379 int width = font.width(spaceSuffixRun); 1380 1380 context->drawText(font, spaceSuffixRun, textOrigin); … … 1646 1646 LayoutUnit itemWidth = font.width(m_text); 1647 1647 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' }; 1648 LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));1648 LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, *style())); 1649 1649 logicalWidth = itemWidth + suffixSpaceWidth; 1650 1650 } … … 1871 1871 int itemWidth = font.width(m_text); 1872 1872 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' }; 1873 int suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));1873 int suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, *style())); 1874 1874 relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height()); 1875 1875 } -
trunk/Source/WebCore/rendering/RenderText.cpp
r156608 r156613 705 705 } 706 706 707 TextRun run = RenderBlock::constructTextRun(const_cast<RenderText*>(this), f, this, start, len, style());707 TextRun run = RenderBlock::constructTextRun(const_cast<RenderText*>(this), f, this, start, len, *style()); 708 708 run.setCharactersLength(textLength() - start); 709 709 ASSERT(run.charactersLength() >= run.length()); … … 760 760 if (stripFrontSpaces) { 761 761 const UChar space = ' '; 762 float spaceWidth = font.width(RenderBlock::constructTextRun(this, font, &space, 1, style()));762 float spaceWidth = font.width(RenderBlock::constructTextRun(this, font, &space, 1, *style())); 763 763 maxW -= spaceWidth; 764 764 } else … … 804 804 } 805 805 806 static inline bool isSpaceAccordingToStyle(UChar c, RenderStyle*style)807 { 808 return c == ' ' || (c == noBreakSpace && style ->nbspMode() == SPACE);806 static inline bool isSpaceAccordingToStyle(UChar c, const RenderStyle& style) 807 { 808 return c == ' ' || (c == noBreakSpace && style.nbspMode() == SPACE); 809 809 } 810 810 … … 837 837 { 838 838 RenderStyle* style = renderer->style(); 839 return font.width(RenderBlock::constructTextRun(renderer, font, style->hyphenString().string(), style));840 } 841 842 static float maxWordFragmentWidth(RenderText* renderer, RenderStyle*style, const Font& font, const UChar* word, int wordLength, int minimumPrefixLength, int minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)839 return font.width(RenderBlock::constructTextRun(renderer, font, style->hyphenString().string(), *style)); 840 } 841 842 static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const Font& font, const UChar* word, int wordLength, int minimumPrefixLength, int minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow) 843 843 { 844 844 suffixStart = 0; … … 848 848 Vector<int, 8> hyphenLocations; 849 849 int hyphenLocation = wordLength - minimumSuffixLength; 850 while ((hyphenLocation = lastHyphenLocation(word, wordLength, hyphenLocation, style ->locale())) >= minimumPrefixLength)850 while ((hyphenLocation = lastHyphenLocation(word, wordLength, hyphenLocation, style.locale())) >= minimumPrefixLength) 851 851 hyphenLocations.append(hyphenLocation); 852 852 … … 862 862 StringBuilder fragmentWithHyphen; 863 863 fragmentWithHyphen.append(word + suffixStart, fragmentLength); 864 fragmentWithHyphen.append(style ->hyphenString());864 fragmentWithHyphen.append(style.hyphenString()); 865 865 866 866 TextRun run = RenderBlock::constructTextRun(renderer, font, fragmentWithHyphen.characters(), fragmentWithHyphen.length(), style); … … 897 897 m_hasEndWS = false; 898 898 899 RenderStyle* styleToUse =style();900 const Font& f = style ToUse->font(); // FIXME: This ignores first-line.901 float wordSpacing = style ToUse->wordSpacing();899 const RenderStyle& style = *this->style(); 900 const Font& f = style.font(); // FIXME: This ignores first-line. 901 float wordSpacing = style.wordSpacing(); 902 902 int len = textLength(); 903 LazyLineBreakIterator breakIterator(m_text, style ToUse->locale());903 LazyLineBreakIterator breakIterator(m_text, style.locale()); 904 904 bool needsWordSpacing = false; 905 905 bool ignoringSpaces = false; … … 912 912 // Non-zero only when kerning is enabled, in which case we measure words with their trailing 913 913 // space, then subtract its width. 914 float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style ToUse), &fallbackFonts) + wordSpacing : 0;914 float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style), &fallbackFonts) + wordSpacing : 0; 915 915 916 916 // If automatic hyphenation is allowed, we keep track of the width of the widest word (or word … … 919 919 int minimumPrefixLength = 0; 920 920 int minimumSuffixLength = 0; 921 if (style ToUse->hyphens() == HyphensAuto && canHyphenate(styleToUse->locale())) {921 if (style.hyphens() == HyphensAuto && canHyphenate(style.locale())) { 922 922 maxWordWidth = 0; 923 923 924 924 // Map 'hyphenate-limit-{before,after}: auto;' to 2. 925 minimumPrefixLength = style ToUse->hyphenationLimitBefore();925 minimumPrefixLength = style.hyphenationLimitBefore(); 926 926 if (minimumPrefixLength < 0) 927 927 minimumPrefixLength = 2; 928 928 929 minimumSuffixLength = style ToUse->hyphenationLimitAfter();929 minimumSuffixLength = style.hyphenationLimitAfter(); 930 930 if (minimumSuffixLength < 0) 931 931 minimumSuffixLength = 2; … … 934 934 int firstGlyphLeftOverflow = -1; 935 935 936 bool breakNBSP = style ToUse->autoWrap() && styleToUse->nbspMode() == SPACE;937 bool breakAll = (style ToUse->wordBreak() == BreakAllWordBreak || styleToUse->wordBreak() == BreakWordBreak) && styleToUse->autoWrap();936 bool breakNBSP = style.autoWrap() && style.nbspMode() == SPACE; 937 bool breakAll = (style.wordBreak() == BreakAllWordBreak || style.wordBreak() == BreakWordBreak) && style.autoWrap(); 938 938 939 939 for (int i = 0; i < len; i++) { … … 944 944 bool isNewline = false; 945 945 if (c == '\n') { 946 if (style ToUse->preserveNewline()) {946 if (style.preserveNewline()) { 947 947 m_hasBreak = true; 948 948 isNewline = true; … … 951 951 isSpace = true; 952 952 } else if (c == '\t') { 953 if (!style ToUse->collapseWhiteSpace()) {953 if (!style.collapseWhiteSpace()) { 954 954 m_hasTab = true; 955 955 isSpace = false; … … 964 964 m_hasEndWS = true; 965 965 966 if (!ignoringSpaces && style ToUse->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)966 if (!ignoringSpaces && style.collapseWhiteSpace() && previousCharacterIsSpace && isSpace) 967 967 ignoringSpaces = true; 968 968 … … 975 975 lastWordBoundary++; 976 976 continue; 977 } else if (c == softHyphen && style ToUse->hyphens() != HyphensNone) {977 } else if (c == softHyphen && style.hyphens() != HyphensNone) { 978 978 currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow); 979 979 if (firstGlyphLeftOverflow < 0) … … 986 986 bool betweenWords = true; 987 987 int j = i; 988 while (c != '\n' && !isSpaceAccordingToStyle(c, style ToUse) && c != '\t' && (c != softHyphen || styleToUse->hyphens() == HyphensNone)) {988 while (c != '\n' && !isSpaceAccordingToStyle(c, style) && c != '\t' && (c != softHyphen || style.hyphens() == HyphensNone)) { 989 989 j++; 990 990 if (j == len) … … 1001 1001 int wordLen = j - i; 1002 1002 if (wordLen) { 1003 bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style ToUse);1003 bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style); 1004 1004 float w; 1005 1005 if (wordTrailingSpaceWidth && isSpace) … … 1007 1007 else { 1008 1008 w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow); 1009 if (c == softHyphen && style ToUse->hyphens() != HyphensNone)1009 if (c == softHyphen && style.hyphens() != HyphensNone) 1010 1010 currMinWidth += hyphenWidth(this, f); 1011 1011 } … … 1013 1013 if (w > maxWordWidth) { 1014 1014 int suffixStart; 1015 float maxFragmentWidth = maxWordFragmentWidth(this, style ToUse, f, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow);1015 float maxFragmentWidth = maxWordFragmentWidth(this, style, f, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow); 1016 1016 1017 1017 if (suffixStart) { … … 1041 1041 } 1042 1042 1043 bool isCollapsibleWhiteSpace = (j < len) && style ToUse->isCollapsibleWhiteSpace(c);1044 if (j < len && style ToUse->autoWrap())1043 bool isCollapsibleWhiteSpace = (j < len) && style.isCollapsibleWhiteSpace(c); 1044 if (j < len && style.autoWrap()) 1045 1045 m_hasBreakableChar = true; 1046 1046 … … 1069 1069 // Nowrap can never be broken, so don't bother setting the 1070 1070 // breakable character boolean. Pre can only be broken if we encounter a newline. 1071 if (style ()->autoWrap() || isNewline)1071 if (style.autoWrap() || isNewline) 1072 1072 m_hasBreakableChar = true; 1073 1073 … … 1080 1080 firstLine = false; 1081 1081 leadWidth = 0; 1082 if (!style ToUse->autoWrap())1082 if (!style.autoWrap()) 1083 1083 m_beginMinWidth = currMaxWidth; 1084 1084 } … … 1088 1088 currMaxWidth = 0; 1089 1089 } else { 1090 TextRun run = RenderBlock::constructTextRun(this, f, this, i, 1, style ToUse);1090 TextRun run = RenderBlock::constructTextRun(this, f, this, i, 1, style); 1091 1091 run.setCharactersLength(len - i); 1092 1092 ASSERT(run.charactersLength() >= run.length()); 1093 run.setTabSize(!style ()->collapseWhiteSpace(), style()->tabSize());1093 run.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); 1094 1094 run.setXPos(leadWidth + currMaxWidth); 1095 1095 … … 1112 1112 m_maxWidth = max(currMaxWidth, m_maxWidth); 1113 1113 1114 if (!style ToUse->autoWrap())1114 if (!style.autoWrap()) 1115 1115 m_minWidth = m_maxWidth; 1116 1116 1117 if (style ToUse->whiteSpace() == PRE) {1117 if (style.whiteSpace() == PRE) { 1118 1118 if (firstLine) 1119 1119 m_beginMinWidth = m_maxWidth; … … 1506 1506 w = widthFromCache(f, from, len, xPos, fallbackFonts, glyphOverflow); 1507 1507 } else { 1508 TextRun run = RenderBlock::constructTextRun(const_cast<RenderText*>(this), f, this, from, len, style());1508 TextRun run = RenderBlock::constructTextRun(const_cast<RenderText*>(this), f, this, from, len, *style()); 1509 1509 run.setCharactersLength(textLength() - from); 1510 1510 ASSERT(run.charactersLength() >= run.length()); -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r156155 r156613 230 230 const String str = String(&ch, 1); 231 231 const Font& font = style()->font(); 232 TextRun textRun = constructTextRun(this, font, str, style(), TextRun::AllowTrailingExpansion);232 TextRun textRun = constructTextRun(this, font, str, *style(), TextRun::AllowTrailingExpansion); 233 233 textRun.disableRoundingHacks(); 234 234 return font.width(textRun); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r156608 r156613 746 746 void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); } 747 747 void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); } 748 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }749 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }748 void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); } 749 void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); } 750 750 751 751 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
Note:
See TracChangeset
for help on using the changeset viewer.