Changeset 156613 in webkit


Ignore:
Timestamp:
Sep 28, 2013 9:34:37 PM (11 years ago)
Author:
Antti Koivisto
Message:

Switch inline boxes to use const RenderStyle&
https://bugs.webkit.org/show_bug.cgi?id=122068

Reviewed by Sam Weinig.

Location:
trunk/Source/WebCore
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156612 r156613  
     12013-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
    182013-09-28  Antti Koivisto  <antti@apple.com>
    29
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r151807 r156613  
    4444    static bool isNeeded(RenderText* text, const Font& font)
    4545    {
    46         TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());
     46        TextRun run = RenderBlock::constructTextRun(text, font, text, *text->style());
    4747        return font.codePath(run) == Font::Complex;
    4848    }
     
    6969    static TextRun constructTextRun(RenderText* text, const Font& font, float xPos)
    7070    {
    71         TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());
     71        TextRun run = RenderBlock::constructTextRun(text, font, text, *text->style());
    7272        run.setCharactersLength(text->textLength());
    7373        ASSERT(run.charactersLength() >= run.length());
  • trunk/Source/WebCore/rendering/EllipsisBox.cpp

    r156608 r156613  
    4545{
    4646    GraphicsContext* context = paintInfo.context;
    47     RenderStyle& lineStyle = this->lineStyle();
     47    const RenderStyle& lineStyle = this->lineStyle();
    4848    Color textColor = lineStyle.visitedDependentColor(CSSPropertyWebkitTextFillColor);
    4949    if (textColor != context->fillColor())
     
    5858    const Font& font = lineStyle.font();
    5959    if (selectionState() != RenderObject::SelectionNone) {
    60         paintSelection(context, paintOffset, &lineStyle, font);
     60        paintSelection(context, paintOffset, lineStyle, font);
    6161
    6262        // Select the correct color for painting the text.
     
    6767
    6868    // 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()));
    7070
    7171    // Restore the regular fill color.
     
    7676        context->clearShadow();
    7777
    78     paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, &lineStyle);
     78    paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, lineStyle);
    7979}
    8080
     
    9797}
    9898
    99 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style)
     99void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle& style)
    100100{
    101101    InlineBox* markupBox = this->markupBox();
     
    105105    LayoutPoint adjustedPaintOffset = paintOffset;
    106106    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()));
    108108    markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom);
    109109}
     
    111111IntRect EllipsisBox::selectionRect()
    112112{
    113     RenderStyle& lineStyle = this->lineStyle();
     113    const RenderStyle& lineStyle = this->lineStyle();
    114114    const Font& font = lineStyle.font();
    115115    const RootInlineBox& rootBox = root();
    116116    // 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()));
    118118}
    119119
    120 void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, RenderStyle* style, const Font& font)
     120void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, const RenderStyle& style, const Font& font)
    121121{
    122     Color textColor = style->visitedDependentColor(CSSPropertyColor);
     122    Color textColor = style.visitedDependentColor(CSSPropertyColor);
    123123    Color c = renderer().selectionBackgroundColor();
    124124    if (!c.isValid() || !c.alpha())
     
    139139    context->clip(clipRect);
    140140    // 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());
    142142}
    143143
     
    148148    // Hit test the markup box.
    149149    if (InlineBox* markupBox = this->markupBox()) {
    150         RenderStyle& lineStyle = this->lineStyle();
     150        const RenderStyle& lineStyle = this->lineStyle();
    151151        LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
    152152        LayoutUnit mty = adjustedLocation.y() + lineStyle.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent());
  • trunk/Source/WebCore/rendering/EllipsisBox.h

    r156095 r156613  
    4040
    4141private:
    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&);
    4343    virtual int height() const { return m_height; }
    4444    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&);
    4646    InlineBox* markupBox() const;
    4747
  • trunk/Source/WebCore/rendering/InlineBox.h

    r156608 r156613  
    281281    bool visibleToHitTesting() const { return renderer().style()->visibility() == VISIBLE && renderer().style()->pointerEvents() != PE_NONE; }
    282282
    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(); }
    284284   
    285285    EVerticalAlign verticalAlign() const { return lineStyle().verticalAlign(); }
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r156608 r156613  
    161161        const RenderStyle& childStyle = child->lineStyle();
    162162        if (child->behavesLikeText()) {
    163             RenderStyle* childStyle = &child->lineStyle();
     163            const RenderStyle* childStyle = &child->lineStyle();
    164164            if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || childStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeWidth())
    165165                child->clearKnownToHaveNoOverflow();
     
    662662        LayoutUnit boxHeightIncludingMargins = boxHeight;
    663663
    664         RenderStyle& childLineStyle = curr->lineStyle();
     664        const RenderStyle& childLineStyle = curr->lineStyle();
    665665        if (curr->behavesLikeText() || curr->isInlineFlowBox()) {
    666666            const FontMetrics& fontMetrics = childLineStyle.fontMetrics();
     
    704704            if (curr->isInlineTextBox()) {
    705705                TextEmphasisPosition emphasisMarkPosition;
    706                 if (toInlineTextBox(curr)->getEmphasisMarkPosition(&childLineStyle, emphasisMarkPosition)) {
     706                if (toInlineTextBox(curr)->getEmphasisMarkPosition(childLineStyle, emphasisMarkPosition)) {
    707707                    bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphasisPositionOver;
    708708                    if (emphasisMarkIsOver != childLineStyle.isFlippedLinesWritingMode())
     
    859859        return;
    860860
    861     RenderStyle& lineStyle = this->lineStyle();
     861    const RenderStyle& lineStyle = this->lineStyle();
    862862   
    863863    GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox);
     
    877877
    878878    TextEmphasisPosition emphasisMarkPosition;
    879     if (lineStyle.textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasisMarkPosition(&lineStyle, emphasisMarkPosition)) {
     879    if (lineStyle.textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasisMarkPosition(lineStyle, emphasisMarkPosition)) {
    880880        int emphasisMarkHeight = lineStyle.font().emphasisMarkHeight(lineStyle.textEmphasisMarkString());
    881881        if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!lineStyle.isFlippedLinesWritingMode()))
     
    12391239}
    12401240
    1241 void InlineFlowBox::paintBoxShadow(const PaintInfo& info, RenderStyle* s, ShadowStyle shadowStyle, const LayoutRect& paintRect)
     1241void InlineFlowBox::paintBoxShadow(const PaintInfo& info, const RenderStyle& style, ShadowStyle shadowStyle, const LayoutRect& paintRect)
    12421242{
    12431243    if ((!prevLineBox() && !nextLineBox()) || !parent())
    1244         boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle);
     1244        boxModelObject()->paintBoxShadow(info, paintRect, &style, shadowStyle);
    12451245    else {
    12461246        // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
    12471247        // 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());
    12491249    }
    12501250}
     
    13151315    if (parent() && !renderer().hasBoxDecorations())
    13161316        return;
    1317     RenderStyle& lineStyle = this->lineStyle();
     1317    const RenderStyle& lineStyle = this->lineStyle();
    13181318    if (!parent() && (!isFirstLine() || &lineStyle == renderer().style()))
    13191319        return;
     
    13241324    // Shadow comes first and is behind the background and border.
    13251325    if (!boxModelObject()->boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, this))
    1326         paintBoxShadow(paintInfo, &lineStyle, Normal, paintRect);
     1326        paintBoxShadow(paintInfo, lineStyle, Normal, paintRect);
    13271327
    13281328    Color c = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor);
    13291329    paintFillLayers(paintInfo, c, lineStyle.backgroundLayers(), paintRect);
    1330     paintBoxShadow(paintInfo, &lineStyle, Inset, paintRect);
     1330    paintBoxShadow(paintInfo, lineStyle, Inset, paintRect);
    13311331
    13321332    // :first-line cannot be used to put borders on a line. Always paint borders with our
     
    15421542
    15431543        if (curr->isInlineTextBox()) {
    1544             RenderStyle& childLineStyle = curr->lineStyle();
     1544            const RenderStyle& childLineStyle = curr->lineStyle();
    15451545            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) {
    15471547                if (!childLineStyle.isFlippedLinesWritingMode()) {
    15481548                    int topOfEmphasisMark = curr->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
     
    15901590
    15911591        if (curr->isInlineTextBox()) {
    1592             RenderStyle& childLineStyle = curr->lineStyle();
     1592            const RenderStyle& childLineStyle = curr->lineStyle();
    15931593            if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && childLineStyle.textEmphasisPosition() == TextEmphasisPositionUnder) {
    15941594                if (!childLineStyle.isFlippedLinesWritingMode()) {
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r156608 r156613  
    7474
    7575    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(); }
    7777
    7878    InlineFlowBox* prevLineBox() const { return m_prevLineBox; }
     
    117117    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
    118118    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&);
    120120    virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom);
    121121    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  
    180180}
    181181
    182 static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, RenderStyle* style, String& string, int& length)
    183 {
    184     const AtomicString& hyphenString = style->hyphenString();
     182static void adjustCharactersAndLengthForHyphen(BufferForAppendingHyphen& charactersWithHyphen, const RenderStyle& style, String& string, int& length)
     183{
     184    const AtomicString& hyphenString = style.hyphenString();
    185185    charactersWithHyphen.reserveCapacity(length + hyphenString.length());
    186186    charactersWithHyphen.append(string);
     
    212212    LayoutUnit selTop = selectionTop();
    213213    LayoutUnit selHeight = selectionHeight();
    214     RenderStyle& lineStyle = this->lineStyle();
     214    const RenderStyle& lineStyle = this->lineStyle();
    215215    const Font& font = fontToUse(lineStyle, renderer());
    216216
    217217    BufferForAppendingHyphen charactersWithHyphen;
    218218    bool respectHyphen = ePos == m_len && hasHyphen();
    219     TextRun textRun = constructTextRun(&lineStyle, font, respectHyphen ? &charactersWithHyphen : 0);
     219    TextRun textRun = constructTextRun(lineStyle, font, respectHyphen ? &charactersWithHyphen : 0);
    220220    if (respectHyphen)
    221221        endPos = textRun.length();
     
    486486}
    487487
    488 bool InlineTextBox::getEmphasisMarkPosition(RenderStyle* style, TextEmphasisPosition& emphasisPosition) const
     488bool InlineTextBox::getEmphasisMarkPosition(const RenderStyle& style, TextEmphasisPosition& emphasisPosition) const
    489489{
    490490    // 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)
    492492        return false;
    493493
    494     emphasisPosition = style->textEmphasisPosition();
     494    emphasisPosition = style.textEmphasisPosition();
    495495    if (emphasisPosition == TextEmphasisPositionUnder)
    496496        return true; // Ruby text is always over, so it cannot suppress emphasis marks under.
     
    565565    GraphicsContext* context = paintInfo.context;
    566566
    567     RenderStyle& lineStyle = this->lineStyle();
     567    const RenderStyle& lineStyle = this->lineStyle();
    568568   
    569569    adjustedPaintOffset.move(0, lineStyle.isHorizontalWritingMode() ? 0 : -logicalHeight());
     
    688688
    689689        if (containsComposition && !useCustomUnderlines)
    690             paintCompositionBackground(context, boxOrigin, &lineStyle, font,
     690            paintCompositionBackground(context, boxOrigin, lineStyle, font,
    691691                renderer().frame().editor().compositionStart(),
    692692                renderer().frame().editor().compositionEnd());
    693693
    694         paintDocumentMarkers(context, boxOrigin, &lineStyle, font, true);
     694        paintDocumentMarkers(context, boxOrigin, lineStyle, font, true);
    695695
    696696        if (haveSelection && !useCustomUnderlines)
    697             paintSelection(context, boxOrigin, &lineStyle, font, selectionFillColor);
     697            paintSelection(context, boxOrigin, lineStyle, font, selectionFillColor);
    698698    }
    699699
     
    724724
    725725    BufferForAppendingHyphen charactersWithHyphen;
    726     TextRun textRun = constructTextRun(&lineStyle, font, string, maximumLength, hasHyphen() ? &charactersWithHyphen : 0);
     726    TextRun textRun = constructTextRun(lineStyle, font, string, maximumLength, hasHyphen() ? &charactersWithHyphen : 0);
    727727    if (hasHyphen())
    728728        length = textRun.length();
     
    741741    int emphasisMarkOffset = 0;
    742742    TextEmphasisPosition emphasisMarkPosition;
    743     bool hasTextEmphasis = getEmphasisMarkPosition(&lineStyle, emphasisMarkPosition);
     743    bool hasTextEmphasis = getEmphasisMarkPosition(lineStyle, emphasisMarkPosition);
    744744    const AtomicString& emphasisMark = hasTextEmphasis ? lineStyle.textEmphasisMarkString() : nullAtom;
    745745    if (!emphasisMark.isEmpty())
     
    812812
    813813    if (paintInfo.phase == PaintPhaseForeground) {
    814         paintDocumentMarkers(context, boxOrigin, &lineStyle, font, false);
     814        paintDocumentMarkers(context, boxOrigin, lineStyle, font, false);
    815815
    816816        if (useCustomUnderlines) {
     
    869869}
    870870
    871 void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, Color textColor)
     871void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, Color textColor)
    872872{
    873873    if (context->paintingDisabled())
     
    890890
    891891    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!
    893893   
    894894    // If the text is truncated, let the thing being painted in the truncation
     
    921921    context->clip(clipRect);
    922922
    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
     926void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, int startPos, int endPos)
    927927{
    928928    int offset = m_start;
     
    937937    Color c = Color(225, 221, 85);
    938938   
    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!
    940940
    941941    int deltaY = renderer().style()->isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
    942942    int selHeight = selectionHeight();
    943943    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);
    945945}
    946946
     
    11681168    bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || underline.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.alpha() == 255) && (!(deco & TextDecorationLineThrough) || linethrough.alpha() == 255);
    11691169
    1170     RenderStyle& lineStyle = this->lineStyle();
     1170    const RenderStyle& lineStyle = this->lineStyle();
    11711171    int baseline = lineStyle.fontMetrics().ascent();
    11721172
     
    13011301}
    13021302
    1303 void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font, bool grammar)
     1303void InlineTextBox::paintDocumentMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, const RenderStyle& style, const Font& font, bool grammar)
    13041304{
    13051305    // Never print spelling/grammar markers (5327887)
     
    13701370}
    13711371
    1372 void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, RenderStyle* style, const Font& font)
     1372void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, const FloatPoint& boxOrigin, DocumentMarker* marker, const RenderStyle& style, const Font& font)
    13731373{
    13741374    // Use same y positioning and height as for selection, so that when the selection and this highlight are on
     
    13921392            renderer().theme()->platformInactiveTextSearchHighlightColor();
    13931393        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!
    13951395        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
     1400void InlineTextBox::computeRectForReplacementMarker(DocumentMarker* marker, const RenderStyle& style, const Font& font)
    14011401{
    14021402    // Replacement markers are not actually drawn, but their rects need to be computed for hit testing.
     
    14151415}
    14161416   
    1417 void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, bool background)
     1417void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, bool background)
    14181418{
    14191419    if (!renderer().textNode())
     
    15541554    FontCachePurgePreventer fontCachePurgePreventer;
    15551555
    1556     RenderStyle& lineStyle = this->lineStyle();
     1556    const RenderStyle& lineStyle = this->lineStyle();
    15571557    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);
    15591559}
    15601560
     
    15691569    FontCachePurgePreventer fontCachePurgePreventer;
    15701570
    1571     RenderStyle& lineStyle = this->lineStyle();
     1571    const RenderStyle& lineStyle = this->lineStyle();
    15721572    const Font& font = fontToUse(lineStyle, renderer());
    15731573    int from = !isLeftToRightDirection() ? offset - m_start : 0;
    15741574    int to = !isLeftToRightDirection() ? m_len : offset - m_start;
    15751575    // 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();
    15771577}
    15781578
     
    16011601}
    16021602
    1603 TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, BufferForAppendingHyphen* charactersWithHyphen) const
    1604 {
    1605     ASSERT(style);
     1603TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& font, BufferForAppendingHyphen* charactersWithHyphen) const
     1604{
    16061605    ASSERT(renderer().text());
    16071606
     
    16161615}
    16171616
    1618 TextRun InlineTextBox::constructTextRun(RenderStyle* style, const Font& font, String string, int maximumLength, BufferForAppendingHyphen* charactersWithHyphen) const
    1619 {
    1620     ASSERT(style);
    1621 
     1617TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& font, String string, int maximumLength, BufferForAppendingHyphen* charactersWithHyphen) const
     1618{
    16221619    int length = string.length();
    16231620
     
    16291626    ASSERT(maximumLength >= length);
    16301627
    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());
    16331630    if (textRunNeedsRenderingContext(font))
    16341631        run.setRenderingContext(SVGTextRunRenderingContext::create(&renderer()));
  • trunk/Source/WebCore/rendering/InlineTextBox.h

    r156608 r156613  
    5959
    6060    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(); }
    6262
    6363    virtual void destroy(RenderArena&) OVERRIDE FINAL;
     
    9292    virtual LayoutUnit lineHeight() const OVERRIDE FINAL;
    9393
    94     bool getEmphasisMarkPosition(RenderStyle*, TextEmphasisPosition&) const;
     94    bool getEmphasisMarkPosition(const RenderStyle&, TextEmphasisPosition&) const;
    9595
    9696    LayoutRect logicalOverflowRect() const;
     
    111111    LayoutUnit selectionHeight();
    112112
    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;
    115115
    116116public:
     
    177177
    178178protected:
    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);
    181181    void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&);
    182182#if PLATFORM(MAC)
     
    186186private:
    187187    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&);
    192192
    193193    TextRun::ExpansionBehavior expansionBehavior() const
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r156608 r156613  
    51645164        const UChar space = ' ';
    51655165        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()));
    51675167        inlineMax -= spaceWidth + font.wordSpacing();
    51685168        if (inlineMin > inlineMax)
     
    67256725
    67266726template <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 
     6727static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
     6728{
    67316729    TextDirection textDirection = LTR;
    6732     bool directionalOverride = style->rtlOrdering() == VisualOrder;
     6730    bool directionalOverride = style.rtlOrdering() == VisualOrder;
    67336731
    67346732    TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
     
    67406738
    67416739template <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 
     6740static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
     6741{
    67466742    TextDirection textDirection = LTR;
    6747     bool directionalOverride = style->rtlOrdering() == VisualOrder;
     6743    bool directionalOverride = style.rtlOrdering() == VisualOrder;
    67486744    if (flags != DefaultTextRunFlags) {
    67496745        if (flags & RespectDirection)
    6750             textDirection = style->direction();
     6746            textDirection = style.direction();
    67516747        if (flags & RespectDirectionOverride)
    6752             directionalOverride |= isOverride(style->unicodeBidi());
     6748            directionalOverride |= isOverride(style.unicodeBidi());
    67536749    }
    67546750    TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
     
    67606756
    67616757#if ENABLE(8BIT_TEXTRUN)
    6762 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
     6758TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
    67636759{
    67646760    return constructTextRunInternal(context, font, characters, length, style, expansion);
     
    67666762#endif
    67676763
    6768 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
     6764TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
    67696765{
    67706766    return constructTextRunInternal(context, font, characters, length, style, expansion);
    67716767}
    67726768
    6773 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, RenderStyle* style, TextRun::ExpansionBehavior expansion)
     6769TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
    67746770{
    67756771#if ENABLE(8BIT_TEXTRUN)
     
    67826778}
    67836779
    6784 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, RenderStyle* style, TextRun::ExpansionBehavior expansion)
     6780TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
    67856781{
    67866782    ASSERT(offset + length <= text->textLength());
     
    67946790}
    67956791
    6796 TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, RenderStyle* style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
     6792TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
    67976793{
    67986794    unsigned length = string.length();
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r156557 r156613  
    298298    static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&);
    299299
    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&,
    301301        TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, TextRunFlags = DefaultTextRunFlags);
    302302
    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&,
    304304        TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
    305305
    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&,
    307307        TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
    308308
    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&,
    310310        TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
    311311
    312312#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&,
    314314        TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
    315315#endif
    316316
    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&,
    318318        TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
    319319
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r156608 r156613  
    602602static inline float measureHyphenWidth(RenderText* renderer, const Font& font, HashSet<const SimpleFontData*>* fallbackFonts = 0)
    603603{
    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);
    606606}
    607607
     
    623623};
    624624
    625 static inline RenderStyle& lineStyle(RenderElement& renderer, const LineInfo& lineInfo)
     625static inline const RenderStyle& lineStyle(RenderElement& renderer, const LineInfo& lineInfo)
    626626{
    627627    return lineInfo.isFirstLine() ? *renderer.firstLineStyle() : *renderer.style();
     
    791791}
    792792
    793 static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, RenderStyle* style)
     793static IndentTextOrNot requiresIndent(bool isFirstLine, bool isAfterHardLineBreak, const RenderStyle& style)
    794794{
    795795    IndentTextOrNot shouldIndentText = DoNotIndentText;
     
    828828    bool isFirstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent()->firstChild() != this);
    829829    bool isAfterHardLineBreak = lineBox->prevRootBox() && lineBox->prevRootBox()->endsWithBreak();
    830     IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLineBreak, style());
     830    IndentTextOrNot shouldIndentText = requiresIndent(isFirstLine, isAfterHardLineBreak, *style());
    831831    float lineLogicalLeft;
    832832    float lineLogicalRight;
     
    23512351static 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)
    23522352{
     2353    const RenderStyle& style = *text->style();
     2354
    23532355    GlyphOverflow glyphOverflow;
    2354     if (isFixedPitch || (!from && len == text->textLength()) || text->style()->hasTextCombine())
     2356    if (isFixedPitch || (!from && len == text->textLength()) || style.hasTextCombine())
    23552357        return text->width(from, len, font, xPos, &fallbackFonts, &glyphOverflow);
    23562358
     
    23582360        return Font::width(*layout, from, len, &fallbackFonts);
    23592361
    2360     TextRun run = RenderBlock::constructTextRun(text, font, text, from, len, text->style());
     2362    TextRun run = RenderBlock::constructTextRun(text, font, text, from, len, style);
    23612363    run.setCharactersLength(text->textLength() - from);
    23622364    ASSERT(run.charactersLength() >= run.length());
     
    23982400        return;
    23992401
    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);
    24012404    run.setCharactersLength(text->textLength() - lastSpace);
    24022405    ASSERT(run.charactersLength() >= run.length());
    24032406
    2404     run.setTabSize(!collapseWhiteSpace, text->style()->tabSize());
     2407    run.setTabSize(!collapseWhiteSpace, style.tabSize());
    24052408    run.setXPos(xPos + lastSpaceWordSpacing);
    24062409
     
    26832686    LineMidpointState& lineMidpointState = resolver.midpointState();
    26842687
    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()));
    26862689
    26872690    skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width);
     
    27192722    // very specific circumstances (in order to match common WinIE renderings).
    27202723    // 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();
    27252728    EWhiteSpace lastWS = currWS;
    27262729    while (current.m_obj) {
    2727         RenderStyle* currentStyle = current.m_obj->style();
     2730        const RenderStyle& currentStyle = *current.m_obj->style();
    27282731        RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj);
    27292732        if (next && next->parent() && !next->parent()->isDescendantOf(current.m_obj->parent()))
    27302733            includeEndWidth = true;
    27312734
    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();
    27332736        lastWS = last->isReplaced() ? last->parent()->style()->whiteSpace() : last->style()->whiteSpace();
    27342737
     
    27622765                // need to check for floats to clear - so if we're ignoring spaces, stop ignoring them and add a
    27632766                // run for this object.
    2764                 if (ignoringSpaces && currentStyle->clear() != CNONE)
     2767                if (ignoringSpaces && currentStyle.clear() != CNONE)
    27652768                    ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj);
    27662769                // If we were preceded by collapsing space and are in a right-aligned container we need to ensure the space gets
    27672770                // collapsed away so that it doesn't push the text out from the container's right-hand edge.
    27682771                // 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))
    27702773                    stopIgnoringSpaces(lineMidpointState, InlineIterator(0, current.m_obj, current.m_pos));
    27712774
    27722775                if (!lineInfo.isEmpty())
    2773                     m_clear = currentStyle->clear();
     2776                    m_clear = currentStyle.clear();
    27742777            }
    27752778            goto end;
     
    28362839                    trailingObjects.clear();
    28372840                    ensureLineBoxInsideIgnoredSpaces(lineMidpointState, current.m_obj);
    2838                 } else if (blockStyle->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj
     2841                } else if (blockStyle.collapseWhiteSpace() && resolver.position().m_obj == current.m_obj
    28392842                    && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
    28402843                    // Like with list markers, we start ignoring spaces to make sure that any
     
    28722875            LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replacedBox) + inlineLogicalWidth(current.m_obj);
    28732876            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)) {
    28752878                    // Like with inline flows, we start ignoring spaces to make sure that any
    28762879                    // additional spaces we see will be discarded.
     
    29132916            }
    29142917
    2915             RenderStyle& style = lineStyle(*t->parent(), lineInfo);
     2918            const RenderStyle& style = lineStyle(*t->parent(), lineInfo);
    29162919            const Font& f = style.font();
    29172920            bool isFixedPitch = f.isFixedPitch();
     
    29192922
    29202923            unsigned lastSpace = current.m_pos;
    2921             float wordSpacing = currentStyle->wordSpacing();
     2924            float wordSpacing = currentStyle.wordSpacing();
    29222925            float lastSpaceWordSpacing = 0;
    29232926            float wordSpacingForWordMeasurement = 0;
     
    29252928            float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true);
    29262929            float charWidth = 0;
    2927             bool breakNBSP = autoWrap && currentStyle->nbspMode() == SPACE;
     2930            bool breakNBSP = autoWrap && currentStyle.nbspMode() == SPACE;
    29282931            // Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
    29292932            // 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);
    29312934            bool midWordBreak = false;
    2932             bool breakAll = currentStyle->wordBreak() == BreakAllWordBreak && autoWrap;
     2935            bool breakAll = currentStyle.wordBreak() == BreakAllWordBreak && autoWrap;
    29332936            float hyphenWidth = 0;
    29342937#if ENABLE(SVG)
     
    29552958            // words with their trailing space, then subtract its width.
    29562959            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;
    29582961
    29592962            UChar lastCharacter = renderTextInfo.m_lineBreakIterator.lastCharacter();
     
    30473050                        // as candidate width for this line.
    30483051                        bool lineWasTooWide = false;
    3049                         if (width.fitsOnLine() && currentCharacterIsWS && currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) {
     3052                        if (width.fitsOnLine() && currentCharacterIsWS && currentStyle.breakOnlyAfterWhiteSpace() && !midWordBreak) {
    30503053                            float charWidth = textWidth(t, current.m_pos, 1, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0);
    30513054                            // Check if line is too big even without the extra space
     
    30623065                        if (lineWasTooWide || !width.fitsOnLine()) {
    30633066                            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);
    30653068                                if (m_hyphenated)
    30663069                                    goto end;
     
    31253128                    }
    31263129
    3127                     if (!ignoringSpaces && currentStyle->collapseWhiteSpace()) {
     3130                    if (!ignoringSpaces && currentStyle.collapseWhiteSpace()) {
    31283131                        // If we encounter a newline, or if we encounter a
    31293132                        // second space, we need to go ahead and break up this
     
    31633166                    // space doesn't seem to push the text out from the right-hand edge.
    31643167                    // 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)) {
    31663169                        ignoreStart.m_pos--;
    31673170                        // If there's just a single trailing space start ignoring it now so it collapses away.
     
    31723175
    31733176                if (!currentCharacterIsWS && previousCharacterIsWS) {
    3174                     if (autoWrap && currentStyle->breakOnlyAfterWhiteSpace())
     3177                    if (autoWrap && currentStyle.breakOnlyAfterWhiteSpace())
    31753178                        lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
    31763179                }
     
    31783181                if (collapseWhiteSpace && currentCharacterIsSpace && !ignoringSpaces)
    31793182                    trailingObjects.setTrailingWhitespace(toRenderText(current.m_obj));
    3180                 else if (!currentStyle->collapseWhiteSpace() || !currentCharacterIsSpace)
     3183                else if (!currentStyle.collapseWhiteSpace() || !currentCharacterIsSpace)
    31813184                    trailingObjects.clear();
    31823185
     
    32143217            if (!width.fitsOnLine()) {
    32153218                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);
    32173220
    32183221                if (!m_hyphenated && lBreak.previousInSameNode() == softHyphen && style.hyphens() != HyphensNone)
     
    32303233        if (canBreakHere && !width.fitsOnLine(ignoringSpaces)) {
    32313234            // if we have floats, try to get below them.
    3232             if (currentCharacterIsSpace && !ignoringSpaces && currentStyle->collapseWhiteSpace())
     3235            if (currentCharacterIsSpace && !ignoringSpaces && currentStyle.collapseWhiteSpace())
    32333236                trailingObjects.clear();
    32343237
     
    32433246            if (!width.fitsOnLine(ignoringSpaces))
    32443247                goto end;
    3245         } else if (blockStyle->autoWrap() && !width.fitsOnLine() && !width.committedWidth()) {
     3248        } else if (blockStyle.autoWrap() && !width.fitsOnLine() && !width.committedWidth()) {
    32463249            // If the container autowraps but the current child does not then we still need to ensure that it
    32473250            // wraps and moves below any floats.
     
    32793282            if (!lBreak.m_obj || !lBreak.m_obj->isBR()) {
    32803283                // we just add as much as possible
    3281                 if (blockStyle->whiteSpace() == PRE && !current.m_pos) {
     3284                if (blockStyle.whiteSpace() == PRE && !current.m_pos) {
    32823285                    lBreak.moveTo(last, last->isText() ? last->length() : 0);
    32833286                } else if (lBreak.m_obj) {
     
    33673370    DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1));
    33683371    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()));
    33713374
    33723375    // 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  
    101101        return;
    102102
    103     TextRun run = RenderBlock::constructTextRun(this, originalFont(), this, style());
     103    TextRun run = RenderBlock::constructTextRun(this, originalFont(), this, *style());
    104104    FontDescription description = originalFont().fontDescription();
    105105    float emWidth = description.computedSize() * textCombineMargin;
  • trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

    r156608 r156613  
    10161016        InlineBox* anchorBox = lastLine->lastChild();
    10171017        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()));
    10191019        else {
    10201020            anchorBox = 0;
    1021             totalWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style()));
     1021            totalWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, *style()));
    10221022        }
    10231023
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r156155 r156613  
    121121        const String& displayedFilename = fileTextValue();
    122122        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);
    124124        textRun.disableRoundingHacks();
    125125
     
    179179    // FIXME: Remove the need for this const_cast by making constructTextRun take a const RenderObject*.
    180180    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));
    182182
    183183    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));
    185185    if (HTMLInputElement* button = uploadButton())
    186186        if (RenderObject* buttonRenderer = button->renderer())
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r155908 r156613  
    128128
    129129        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));
    131131        imageSize = imageSize.expandedTo(paddedTextSize);
    132132    }
     
    393393                // Only draw the alt text if it'll fit within the content box,
    394394                // 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());
    396396                LayoutUnit textWidth = font.width(textRun);
    397397                if (errorPictureDrawn) {
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r156558 r156613  
    131131                applyTextTransform(style(), text, ' ');
    132132                // 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);
    134134                textRun.disableRoundingHacks();
    135135                float textWidth = itemFont.width(textRun);
  • trunk/Source/WebCore/rendering/RenderListMarker.cpp

    r156025 r156613  
    13381338
    13391339    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());
    13411341
    13421342    GraphicsContextStateSaver stateSaver(*context, false);
     
    13731373            context->drawText(font, textRun, textOrigin);
    13741374            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));
    13761376        } else {
    13771377            UChar spaceSuffix[2] = { ' ', suffix };
    1378             TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, style());
     1378            TextRun spaceSuffixRun = RenderBlock::constructTextRun(this, font, spaceSuffix, 2, *style());
    13791379            int width = font.width(spaceSuffixRun);
    13801380            context->drawText(font, spaceSuffixRun, textOrigin);
     
    16461646                LayoutUnit itemWidth = font.width(m_text);
    16471647                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()));
    16491649                logicalWidth = itemWidth + suffixSpaceWidth;
    16501650            }
     
    18711871            int itemWidth = font.width(m_text);
    18721872            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()));
    18741874            relativeRect = IntRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height());
    18751875    }
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r156608 r156613  
    705705    }
    706706
    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());
    708708    run.setCharactersLength(textLength() - start);
    709709    ASSERT(run.charactersLength() >= run.length());
     
    760760        if (stripFrontSpaces) {
    761761            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()));
    763763            maxW -= spaceWidth;
    764764        } else
     
    804804}
    805805
    806 static inline bool isSpaceAccordingToStyle(UChar c, RenderStyle* style)
    807 {
    808     return c == ' ' || (c == noBreakSpace && style->nbspMode() == SPACE);
     806static inline bool isSpaceAccordingToStyle(UChar c, const RenderStyle& style)
     807{
     808    return c == ' ' || (c == noBreakSpace && style.nbspMode() == SPACE);
    809809}
    810810
     
    837837{
    838838    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
     842static 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)
    843843{
    844844    suffixStart = 0;
     
    848848    Vector<int, 8> hyphenLocations;
    849849    int hyphenLocation = wordLength - minimumSuffixLength;
    850     while ((hyphenLocation = lastHyphenLocation(word, wordLength, hyphenLocation, style->locale())) >= minimumPrefixLength)
     850    while ((hyphenLocation = lastHyphenLocation(word, wordLength, hyphenLocation, style.locale())) >= minimumPrefixLength)
    851851        hyphenLocations.append(hyphenLocation);
    852852
     
    862862        StringBuilder fragmentWithHyphen;
    863863        fragmentWithHyphen.append(word + suffixStart, fragmentLength);
    864         fragmentWithHyphen.append(style->hyphenString());
     864        fragmentWithHyphen.append(style.hyphenString());
    865865
    866866        TextRun run = RenderBlock::constructTextRun(renderer, font, fragmentWithHyphen.characters(), fragmentWithHyphen.length(), style);
     
    897897    m_hasEndWS = false;
    898898
    899     RenderStyle* styleToUse = style();
    900     const Font& f = styleToUse->font(); // FIXME: This ignores first-line.
    901     float wordSpacing = styleToUse->wordSpacing();
     899    const RenderStyle& style = *this->style();
     900    const Font& f = style.font(); // FIXME: This ignores first-line.
     901    float wordSpacing = style.wordSpacing();
    902902    int len = textLength();
    903     LazyLineBreakIterator breakIterator(m_text, styleToUse->locale());
     903    LazyLineBreakIterator breakIterator(m_text, style.locale());
    904904    bool needsWordSpacing = false;
    905905    bool ignoringSpaces = false;
     
    912912    // Non-zero only when kerning is enabled, in which case we measure words with their trailing
    913913    // space, then subtract its width.
    914     float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, styleToUse), &fallbackFonts) + wordSpacing : 0;
     914    float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style), &fallbackFonts) + wordSpacing : 0;
    915915
    916916    // If automatic hyphenation is allowed, we keep track of the width of the widest word (or word
     
    919919    int minimumPrefixLength = 0;
    920920    int minimumSuffixLength = 0;
    921     if (styleToUse->hyphens() == HyphensAuto && canHyphenate(styleToUse->locale())) {
     921    if (style.hyphens() == HyphensAuto && canHyphenate(style.locale())) {
    922922        maxWordWidth = 0;
    923923
    924924        // Map 'hyphenate-limit-{before,after}: auto;' to 2.
    925         minimumPrefixLength = styleToUse->hyphenationLimitBefore();
     925        minimumPrefixLength = style.hyphenationLimitBefore();
    926926        if (minimumPrefixLength < 0)
    927927            minimumPrefixLength = 2;
    928928
    929         minimumSuffixLength = styleToUse->hyphenationLimitAfter();
     929        minimumSuffixLength = style.hyphenationLimitAfter();
    930930        if (minimumSuffixLength < 0)
    931931            minimumSuffixLength = 2;
     
    934934    int firstGlyphLeftOverflow = -1;
    935935
    936     bool breakNBSP = styleToUse->autoWrap() && styleToUse->nbspMode() == SPACE;
    937     bool breakAll = (styleToUse->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();
    938938
    939939    for (int i = 0; i < len; i++) {
     
    944944        bool isNewline = false;
    945945        if (c == '\n') {
    946             if (styleToUse->preserveNewline()) {
     946            if (style.preserveNewline()) {
    947947                m_hasBreak = true;
    948948                isNewline = true;
     
    951951                isSpace = true;
    952952        } else if (c == '\t') {
    953             if (!styleToUse->collapseWhiteSpace()) {
     953            if (!style.collapseWhiteSpace()) {
    954954                m_hasTab = true;
    955955                isSpace = false;
     
    964964            m_hasEndWS = true;
    965965
    966         if (!ignoringSpaces && styleToUse->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
     966        if (!ignoringSpaces && style.collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
    967967            ignoringSpaces = true;
    968968
     
    975975            lastWordBoundary++;
    976976            continue;
    977         } else if (c == softHyphen && styleToUse->hyphens() != HyphensNone) {
     977        } else if (c == softHyphen && style.hyphens() != HyphensNone) {
    978978            currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
    979979            if (firstGlyphLeftOverflow < 0)
     
    986986        bool betweenWords = true;
    987987        int j = i;
    988         while (c != '\n' && !isSpaceAccordingToStyle(c, styleToUse) && c != '\t' && (c != softHyphen || styleToUse->hyphens() == HyphensNone)) {
     988        while (c != '\n' && !isSpaceAccordingToStyle(c, style) && c != '\t' && (c != softHyphen || style.hyphens() == HyphensNone)) {
    989989            j++;
    990990            if (j == len)
     
    10011001        int wordLen = j - i;
    10021002        if (wordLen) {
    1003             bool isSpace = (j < len) && isSpaceAccordingToStyle(c, styleToUse);
     1003            bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style);
    10041004            float w;
    10051005            if (wordTrailingSpaceWidth && isSpace)
     
    10071007            else {
    10081008                w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
    1009                 if (c == softHyphen && styleToUse->hyphens() != HyphensNone)
     1009                if (c == softHyphen && style.hyphens() != HyphensNone)
    10101010                    currMinWidth += hyphenWidth(this, f);
    10111011            }
     
    10131013            if (w > maxWordWidth) {
    10141014                int suffixStart;
    1015                 float maxFragmentWidth = maxWordFragmentWidth(this, styleToUse, f, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow);
     1015                float maxFragmentWidth = maxWordFragmentWidth(this, style, f, characters() + i, wordLen, minimumPrefixLength, minimumSuffixLength, suffixStart, fallbackFonts, glyphOverflow);
    10161016
    10171017                if (suffixStart) {
     
    10411041            }
    10421042
    1043             bool isCollapsibleWhiteSpace = (j < len) && styleToUse->isCollapsibleWhiteSpace(c);
    1044             if (j < len && styleToUse->autoWrap())
     1043            bool isCollapsibleWhiteSpace = (j < len) && style.isCollapsibleWhiteSpace(c);
     1044            if (j < len && style.autoWrap())
    10451045                m_hasBreakableChar = true;
    10461046
     
    10691069            // Nowrap can never be broken, so don't bother setting the
    10701070            // breakable character boolean. Pre can only be broken if we encounter a newline.
    1071             if (style()->autoWrap() || isNewline)
     1071            if (style.autoWrap() || isNewline)
    10721072                m_hasBreakableChar = true;
    10731073
     
    10801080                    firstLine = false;
    10811081                    leadWidth = 0;
    1082                     if (!styleToUse->autoWrap())
     1082                    if (!style.autoWrap())
    10831083                        m_beginMinWidth = currMaxWidth;
    10841084                }
     
    10881088                currMaxWidth = 0;
    10891089            } else {
    1090                 TextRun run = RenderBlock::constructTextRun(this, f, this, i, 1, styleToUse);
     1090                TextRun run = RenderBlock::constructTextRun(this, f, this, i, 1, style);
    10911091                run.setCharactersLength(len - i);
    10921092                ASSERT(run.charactersLength() >= run.length());
    1093                 run.setTabSize(!style()->collapseWhiteSpace(), style()->tabSize());
     1093                run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
    10941094                run.setXPos(leadWidth + currMaxWidth);
    10951095
     
    11121112    m_maxWidth = max(currMaxWidth, m_maxWidth);
    11131113
    1114     if (!styleToUse->autoWrap())
     1114    if (!style.autoWrap())
    11151115        m_minWidth = m_maxWidth;
    11161116
    1117     if (styleToUse->whiteSpace() == PRE) {
     1117    if (style.whiteSpace() == PRE) {
    11181118        if (firstLine)
    11191119            m_beginMinWidth = m_maxWidth;
     
    15061506            w = widthFromCache(f, from, len, xPos, fallbackFonts, glyphOverflow);
    15071507    } 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());
    15091509        run.setCharactersLength(textLength() - from);
    15101510        ASSERT(run.charactersLength() >= run.length());
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r156155 r156613  
    230230    const String str = String(&ch, 1);
    231231    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);
    233233    textRun.disableRoundingHacks();
    234234    return font.width(textRun);
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r156608 r156613  
    746746    void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
    747747    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); }
    750750
    751751    float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
Note: See TracChangeset for help on using the changeset viewer.