Changeset 105394 in webkit


Ignore:
Timestamp:
Jan 19, 2012 1:22:59 AM (12 years ago)
Author:
mihnea@adobe.com
Message:

Cache RenderStyle pointer as a method to avoid performance regression for region styling
https://bugs.webkit.org/show_bug.cgi?id=76265

Reviewed by David Hyatt.

No new tests since this is just refactoring.
When region styling was enabled in https://bugs.webkit.org/show_bug.cgi?id=71488,
it introduced a performance regression due to the change of RenderObject::style() method.
This patch tries to avoid a new performance regression when region styling will be enabled again.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::MarginInfo::MarginInfo):
(WebCore::RenderBlock::styleWillChange):
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::layoutBlockChildren):
(WebCore::RenderBlock::layoutBlockChild):
(WebCore::RenderBlock::computePreferredLogicalWidths):
(WebCore::getBorderPaddingMargin):
(WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::layoutRunsAndFloatsInRange):
(WebCore::RenderBlock::LineBreaker::nextLineBreak):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::willBeDestroyed):
(WebCore::RenderBox::styleWillChange):
(WebCore::RenderBox::styleDidChange):
(WebCore::RenderBox::updateBoxModelInfoFromStyle):
(WebCore::RenderBox::computeRectForRepaint):
(WebCore::RenderBox::computeLogicalWidthInRegion):
(WebCore::RenderBox::computeLogicalWidthUsing):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computePercentageLogicalHeight):
(WebCore::RenderBox::computePositionedLogicalHeight):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::styleWillChange):
(WebCore::RenderBoxModelObject::updateBoxModelInfoFromStyle):

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::styleDidChange):

  • rendering/RenderText.cpp:

(WebCore::RenderText::styleDidChange):
(WebCore::RenderText::computePreferredLogicalWidths):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r105393 r105394  
     12012-01-19  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        Cache RenderStyle pointer as a method to avoid performance regression for region styling
     4        https://bugs.webkit.org/show_bug.cgi?id=76265
     5
     6        Reviewed by David Hyatt.
     7
     8        No new tests since this is just refactoring.
     9        When region styling was enabled in https://bugs.webkit.org/show_bug.cgi?id=71488,
     10        it introduced a performance regression due to the change of RenderObject::style() method.
     11        This patch tries to avoid a new performance regression when region styling will be enabled again.
     12
     13        * rendering/RenderBlock.cpp:
     14        (WebCore::RenderBlock::MarginInfo::MarginInfo):
     15        (WebCore::RenderBlock::styleWillChange):
     16        (WebCore::RenderBlock::layoutBlock):
     17        (WebCore::RenderBlock::layoutBlockChildren):
     18        (WebCore::RenderBlock::layoutBlockChild):
     19        (WebCore::RenderBlock::computePreferredLogicalWidths):
     20        (WebCore::getBorderPaddingMargin):
     21        (WebCore::RenderBlock::computeInlinePreferredLogicalWidths):
     22        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths):
     23        * rendering/RenderBlockLineLayout.cpp:
     24        (WebCore::RenderBlock::layoutRunsAndFloatsInRange):
     25        (WebCore::RenderBlock::LineBreaker::nextLineBreak):
     26        * rendering/RenderBox.cpp:
     27        (WebCore::RenderBox::willBeDestroyed):
     28        (WebCore::RenderBox::styleWillChange):
     29        (WebCore::RenderBox::styleDidChange):
     30        (WebCore::RenderBox::updateBoxModelInfoFromStyle):
     31        (WebCore::RenderBox::computeRectForRepaint):
     32        (WebCore::RenderBox::computeLogicalWidthInRegion):
     33        (WebCore::RenderBox::computeLogicalWidthUsing):
     34        (WebCore::RenderBox::computeLogicalHeight):
     35        (WebCore::RenderBox::computePercentageLogicalHeight):
     36        (WebCore::RenderBox::computePositionedLogicalHeight):
     37        * rendering/RenderBoxModelObject.cpp:
     38        (WebCore::RenderBoxModelObject::styleWillChange):
     39        (WebCore::RenderBoxModelObject::updateBoxModelInfoFromStyle):
     40        * rendering/RenderInline.cpp:
     41        (WebCore::RenderInline::styleDidChange):
     42        * rendering/RenderText.cpp:
     43        (WebCore::RenderText::styleDidChange):
     44        (WebCore::RenderText::computePreferredLogicalWidths):
     45
    1462012-01-19  Kazuhiro Inaba  <kinaba@chromium.org>
    247
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r105176 r105394  
    9797    // if we had any border/padding (obviously), if we're the root or HTML elements, or if
    9898    // we're positioned, floating, a table cell.
     99    RenderStyle* blockStyle = block->style();
    99100    m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned()
    100101        && !block->isFloating() && !block->isTableCell() && !block->hasOverflowClip() && !block->isInlineBlockOrInlineTable()
    101         && !block->isWritingModeRoot() && block->style()->hasAutoColumnCount() && block->style()->hasAutoColumnWidth()
    102         && !block->style()->columnSpan();
    103 
    104     m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && (beforeBorderPadding == 0) && block->style()->marginBeforeCollapse() != MSEPARATE;
     102        && !block->isWritingModeRoot() && blockStyle->hasAutoColumnCount() && blockStyle->hasAutoColumnWidth()
     103        && !blockStyle->columnSpan();
     104
     105    m_canCollapseMarginBeforeWithChildren = m_canCollapseWithChildren && !beforeBorderPadding && blockStyle->marginBeforeCollapse() != MSEPARATE;
    105106
    106107    // If any height other than auto is specified in CSS, then we don't collapse our bottom
     
    109110    // with it.  We also don't collapse if we have any bottom border/padding.
    110111    m_canCollapseMarginAfterWithChildren = m_canCollapseWithChildren && (afterBorderPadding == 0) &&
    111         (block->style()->logicalHeight().isAuto() && block->style()->logicalHeight().value() == 0) && block->style()->marginAfterCollapse() != MSEPARATE;
    112    
    113     m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginBeforeCollapse() == MDISCARD ||
    114         block->style()->marginAfterCollapse() == MDISCARD;
     112        (blockStyle->logicalHeight().isAuto() && !blockStyle->logicalHeight().value()) && blockStyle->marginAfterCollapse() != MSEPARATE;
     113   
     114    m_quirkContainer = block->isTableCell() || block->isBody() || blockStyle->marginBeforeCollapse() == MDISCARD
     115        || blockStyle->marginAfterCollapse() == MDISCARD;
    115116
    116117    m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : 0;
     
    210211void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
    211212{
    212     s_canPropagateFloatIntoSibling = style() ? !isFloatingOrPositioned() && !avoidsFloats() : false;
     213    RenderStyle* oldStyle = style();
     214    s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrPositioned() && !avoidsFloats() : false;
    213215
    214216    setReplaced(newStyle->isDisplayInlineType());
    215217   
    216     if (style() && parent() && diff == StyleDifferenceLayout && style()->position() != newStyle->position()) {
     218    if (oldStyle && parent() && diff == StyleDifferenceLayout && oldStyle->position() != newStyle->position()) {
    217219        if (newStyle->position() == StaticPosition)
    218220            // Clear our positioned objects list. Our absolutely positioned descendants will be
    219221            // inserted into our containing block's positioned objects list during layout.
    220222            removePositionedObjects(0);
    221         else if (style()->position() == StaticPosition) {
     223        else if (oldStyle->position() == StaticPosition) {
    222224            // Remove our absolutely positioned descendants from their current containing block.
    223225            // They will be inserted into our positioned objects list during layout.
     
    12501252
    12511253    RenderView* renderView = view();
    1252     LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo);
     1254    RenderStyle* styleToUse = style();
     1255    LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo);
    12531256   
    12541257    if (inRenderFlowThread()) {
     
    12821285        initMaxMarginValues();
    12831286       
    1284         setMarginBeforeQuirk(style()->marginBefore().quirk());
    1285         setMarginAfterQuirk(style()->marginAfter().quirk());
     1287        setMarginBeforeQuirk(styleToUse->marginBefore().quirk());
     1288        setMarginAfterQuirk(styleToUse->marginAfter().quirk());
    12861289
    12871290        Node* n = node();
     
    12971300    // For overflow:scroll blocks, ensure we have both scrollbars in place always.
    12981301    if (scrollsOverflow()) {
    1299         if (style()->overflowX() == OSCROLL)
     1302        if (styleToUse->overflowX() == OSCROLL)
    13001303            layer()->setHasHorizontalScrollbar(true);
    1301         if (style()->overflowY() == OSCROLL)
     1304        if (styleToUse->overflowY() == OSCROLL)
    13021305            layer()->setHasVerticalScrollbar(true);
    13031306    }
     
    13641367    // Repaint with our new bounds if they are different from our old bounds.
    13651368    bool didFullRepaint = repainter.repaintAfterLayout();
    1366     if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (style()->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {
     1369    if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (styleToUse->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {
    13671370        // FIXME: We could tighten up the left and right invalidation points if we let layoutInlineChildren fill them in based off the particular lines
    13681371        // it had to lay out.  We wouldn't need the hasOverflowClip() hack in that case either.
     
    20192022        // FIXME: Technically percentage height objects only need a relayout if their percentage isn't going to be turned into
    20202023        // an auto value.  Add a method to determine this, so that we can avoid the relayout.
    2021         if (relayoutChildren || ((child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent()) && !isRenderView()))
     2024        RenderStyle* childStyle = child->style();
     2025        if (relayoutChildren || ((childStyle->logicalHeight().isPercent() || childStyle->logicalMinHeight().isPercent() || childStyle->logicalMaxHeight().isPercent()) && !isRenderView()))
    20222026            child->setChildNeedsLayout(true, false);
    20232027
     
    20492053
    20502054    // Do not allow a collapse if the margin-before-collapse style is set to SEPARATE.
    2051     if (child->style()->marginBeforeCollapse() == MSEPARATE) {
     2055    RenderStyle* childStyle = child->style();
     2056    if (childStyle->marginBeforeCollapse() == MSEPARATE) {
    20522057        marginInfo.setAtBeforeSideOfBlock(false);
    20532058        marginInfo.clearMargin();
     
    21452150    // Update our height now that the child has been placed in the correct position.
    21462151    setLogicalHeight(logicalHeight() + logicalHeightForChild(child));
    2147     if (child->style()->marginAfterCollapse() == MSEPARATE) {
     2152    if (childStyle->marginAfterCollapse() == MSEPARATE) {
    21482153        setLogicalHeight(logicalHeight() + marginAfterForChild(child));
    21492154        marginInfo.clearMargin();
     
    49434948    updateFirstLetter();
    49444949
    4945     if (!isTableCell() && style()->logicalWidth().isFixed() && style()->logicalWidth().value() > 0)
    4946         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->logicalWidth().value());
     4950    RenderStyle* styleToUse = style();
     4951    if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() > 0)
     4952        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(styleToUse->logicalWidth().value());
    49474953    else {
    49484954        m_minPreferredLogicalWidth = 0;
     
    49564962        m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
    49574963
    4958         if (!style()->autoWrap() && childrenInline()) {
     4964        if (!styleToUse->autoWrap() && childrenInline()) {
    49594965            m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
    49604966           
     
    49654971
    49664972        int scrollbarWidth = 0;
    4967         if (hasOverflowClip() && style()->overflowY() == OSCROLL) {
     4973        if (hasOverflowClip() && styleToUse->overflowY() == OSCROLL) {
    49684974            layer()->setHasVerticalScrollbar(true);
    49694975            scrollbarWidth = verticalScrollbarWidth();
     
    49824988    }
    49834989   
    4984     if (style()->logicalMinWidth().isFixed() && style()->logicalMinWidth().value() > 0) {
    4985         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMinWidth().value()));
    4986         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMinWidth().value()));
    4987     }
    4988    
    4989     if (style()->logicalMaxWidth().isFixed()) {
    4990         m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMaxWidth().value()));
    4991         m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMaxWidth().value()));
     4990    if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) {
     4991        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMinWidth().value()));
     4992        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMinWidth().value()));
     4993    }
     4994   
     4995    if (styleToUse->logicalMaxWidth().isFixed()) {
     4996        m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMaxWidth().value()));
     4997        m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(styleToUse->logicalMaxWidth().value()));
    49924998    }
    49934999
     
    50725078static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfInline)
    50735079{
    5074     RenderStyle* cstyle = child->style();
     5080    RenderStyle* childStyle = child->style();
    50755081    if (endOfInline)
    5076         return getBPMWidth(child->marginEnd(), cstyle->marginEnd()) +
    5077                getBPMWidth(child->paddingEnd(), cstyle->paddingEnd()) +
     5082        return getBPMWidth(child->marginEnd(), childStyle->marginEnd()) +
     5083               getBPMWidth(child->paddingEnd(), childStyle->paddingEnd()) +
    50785084               child->borderEnd();
    5079     return getBPMWidth(child->marginStart(), cstyle->marginStart()) +
    5080                getBPMWidth(child->paddingStart(), cstyle->paddingStart()) +
     5085    return getBPMWidth(child->marginStart(), childStyle->marginStart()) +
     5086               getBPMWidth(child->paddingStart(), childStyle->paddingStart()) +
    50815087               child->borderStart();
    50825088}
     
    51085114    float inlineMin = 0;
    51095115
     5116    RenderStyle* styleToUse = style();
    51105117    RenderBlock* containingBlock = this->containingBlock();
    51115118    LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : 0;
     
    51195126    // very specific cirucumstances (in order to match common WinIE renderings).
    51205127    // Not supporting the quirk has caused us to mis-render some real sites. (See Bugzilla 10517.)
    5121     bool allowImagesToBreak = !document()->inQuirksMode() || !isTableCell() || !style()->logicalWidth().isIntrinsicOrAuto();
     5128    bool allowImagesToBreak = !document()->inQuirksMode() || !isTableCell() || !styleToUse->logicalWidth().isIntrinsicOrAuto();
    51225129
    51235130    bool autoWrap, oldAutoWrap;
    5124     autoWrap = oldAutoWrap = style()->autoWrap();
     5131    autoWrap = oldAutoWrap = styleToUse->autoWrap();
    51255132
    51265133    InlineMinMaxIterator childIterator(this);
     
    51675174            // the width of the last non-breakable run and use that to start a new line
    51685175            // (unless we end in whitespace).
    5169             RenderStyle* cstyle = child->style();
     5176            RenderStyle* childStyle = child->style();
    51705177            float childMin = 0;
    51715178            float childMax = 0;
     
    51875194                    // Inline replaced elts add in their margins to their min/max values.
    51885195                    float margins = 0;
    5189                     Length startMargin = cstyle->marginStart();
    5190                     Length endMargin = cstyle->marginEnd();
     5196                    Length startMargin = childStyle->marginStart();
     5197                    Length endMargin = childStyle->marginEnd();
    51915198                    if (startMargin.isFixed())
    51925199                        margins += startMargin.value();
     
    52085215                if (child->isFloating()) {
    52095216                    clearPreviousFloat = (prevFloat
    5210                         && ((prevFloat->style()->floating() == LeftFloat && (child->style()->clear() & CLEFT))
    5211                             || (prevFloat->style()->floating() == RightFloat && (child->style()->clear() & CRIGHT))));
     5217                        && ((prevFloat->style()->floating() == LeftFloat && (childStyle->clear() & CLEFT))
     5218                            || (prevFloat->style()->floating() == RightFloat && (childStyle->clear() & CRIGHT))));
    52125219                    prevFloat = child;
    52135220                } else
     
    52305237                if (!addedTextIndent) {
    52315238                    addedTextIndent = true;
    5232                     ti = style()->textIndent().calcMinValue(cw);
     5239                    ti = styleToUse->textIndent().calcMinValue(cw);
    52335240                    childMin += ti;
    52345241                    childMax += ti;
     
    53015308                if (!addedTextIndent) {
    53025309                    addedTextIndent = true;
    5303                     ti = style()->textIndent().calcMinValue(cw);
     5310                    ti = styleToUse->textIndent().calcMinValue(cw);
    53045311                    childMin+=ti; beginMin += ti;
    53055312                    childMax+=ti; beginMax += ti;
     
    53595366    }
    53605367
    5361     if (style()->collapseWhiteSpace())
     5368    if (styleToUse->collapseWhiteSpace())
    53625369        stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild);
    53635370
     
    53715378void RenderBlock::computeBlockPreferredLogicalWidths()
    53725379{
    5373     bool nowrap = style()->whiteSpace() == NOWRAP;
     5380    RenderStyle* styleToUse = style();
     5381    bool nowrap = styleToUse->whiteSpace() == NOWRAP;
    53745382
    53755383    RenderObject* child = firstChild();
     
    53835391        }
    53845392
     5393        RenderStyle* childStyle = child->style();
    53855394        if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) {
    53865395            LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth;
    5387             if (child->style()->clear() & CLEFT) {
     5396            if (childStyle->clear() & CLEFT) {
    53885397                m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth);
    53895398                floatLeftWidth = 0;
    53905399            }
    5391             if (child->style()->clear() & CRIGHT) {
     5400            if (childStyle->clear() & CRIGHT) {
    53925401                m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth);
    53935402                floatRightWidth = 0;
     
    53985407        // Auto and percentage margins simply become 0 when computing min/max width.
    53995408        // Fixed margins can be added in as is.
    5400         Length startMarginLength = child->style()->marginStartUsing(style());
    5401         Length endMarginLength = child->style()->marginEndUsing(style());
     5409        Length startMarginLength = childStyle->marginStartUsing(styleToUse);
     5410        Length endMarginLength = childStyle->marginEndUsing(styleToUse);
    54025411        LayoutUnit margin = 0;
    54035412        LayoutUnit marginStart = 0;
     
    54365445                // margins of the object.  For negative margins, we will attempt to overlap the float if the negative margin
    54375446                // is smaller than the float width.
    5438                 bool ltr = containingBlock ? containingBlock->style()->isLeftToRightDirection() : style()->isLeftToRightDirection();
     5447                bool ltr = containingBlock ? containingBlock->style()->isLeftToRightDirection() : styleToUse->isLeftToRightDirection();
    54395448                LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd;
    54405449                LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart;
     
    54505459       
    54515460        if (child->isFloating()) {
    5452             if (style()->floating() == LeftFloat)
     5461            if (styleToUse->floating() == LeftFloat)
    54535462                floatLeftWidth += w;
    54545463            else
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r105176 r105394  
    12111211void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines)
    12121212{
     1213    RenderStyle* styleToUse = style();
    12131214    bool paginated = view()->layoutState() && view()->layoutState()->isPaginated();
    12141215    LineMidpointState& lineMidpointState = resolver.midpointState();
     
    12551256                lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status());
    12561257        } else {
    1257             VisualDirectionOverride override = (style()->rtlOrdering() == VisualOrder ? (style()->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
    1258 
    1259             if (isNewUBAParagraph && style()->unicodeBidi() == Plaintext && !resolver.context()->parent()) {
    1260                 TextDirection direction = style()->direction();
     1258            VisualDirectionOverride override = (styleToUse->rtlOrdering() == VisualOrder ? (styleToUse->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
     1259
     1260            if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !resolver.context()->parent()) {
     1261                TextDirection direction = styleToUse->direction();
    12611262                determineParagraphDirection(direction, resolver.position());
    1262                 resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override));
     1263                resolver.setStatus(BidiStatus(direction, styleToUse->unicodeBidi() == Override));
    12631264            }
    12641265            // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine.
     
    21322133    // very specific circumstances (in order to match common WinIE renderings).
    21332134    // Not supporting the quirk has caused us to mis-render some real sites. (See Bugzilla 10517.)
    2134     bool allowImagesToBreak = !m_block->document()->inQuirksMode() || !m_block->isTableCell() || !m_block->style()->logicalWidth().isIntrinsicOrAuto();
    2135 
    2136     EWhiteSpace currWS = m_block->style()->whiteSpace();
     2135    RenderStyle* blockStyle = m_block->style();
     2136    bool allowImagesToBreak = !m_block->document()->inQuirksMode() || !m_block->isTableCell() || !blockStyle->logicalWidth().isIntrinsicOrAuto();
     2137
     2138    EWhiteSpace currWS = blockStyle->whiteSpace();
    21372139    EWhiteSpace lastWS = currWS;
    21382140    while (current.m_obj) {
     2141        RenderStyle* currentStyle = current.m_obj->style();
    21392142        RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj);
    21402143        if (next && next->parent() && !next->parent()->isDescendantOf(current.m_obj->parent()))
    21412144            includeEndWidth = true;
    21422145
    2143         currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()->whiteSpace() : current.m_obj->style()->whiteSpace();
     2146        currWS = current.m_obj->isReplaced() ? current.m_obj->parent()->style()->whiteSpace() : currentStyle->whiteSpace();
    21442147        lastWS = last->isReplaced() ? last->parent()->style()->whiteSpace() : last->style()->whiteSpace();
    21452148
     
    21712174
    21722175                if (!lineInfo.isEmpty())
    2173                     m_clear = current.m_obj->style()->clear();
     2176                    m_clear = currentStyle->clear();
    21742177            }
    21752178            goto end;
     
    22312234                    addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Stop ignoring spaces.
    22322235                    addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Start ignoring again.
    2233                 } else if (m_block->style()->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj
     2236                } else if (blockStyle->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj
    22342237                    && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
    22352238                    // Like with list markers, we start ignoring spaces to make sure that any
     
    22642267            LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replacedBox) + inlineLogicalWidth(current.m_obj);
    22652268            if (current.m_obj->isListMarker()) {
    2266                 if (m_block->style()->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
     2269                if (blockStyle->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) {
    22672270                    // Like with inline flows, we start ignoring spaces to make sure that any
    22682271                    // additional spaces we see will be discarded.
     
    22962299
    22972300            int lastSpace = current.m_pos;
    2298             float wordSpacing = current.m_obj->style()->wordSpacing();
     2301            float wordSpacing = currentStyle->wordSpacing();
    22992302            float lastSpaceWordSpacing = 0;
    23002303
     
    23052308            float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true);
    23062309            float charWidth = 0;
    2307             bool breakNBSP = autoWrap && current.m_obj->style()->nbspMode() == SPACE;
     2310            bool breakNBSP = autoWrap && currentStyle->nbspMode() == SPACE;
    23082311            // Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
    23092312            // which is only possible if the word is the first thing on the line, that is, if |w| is zero.
    2310             bool breakWords = current.m_obj->style()->breakWords() && ((autoWrap && !width.committedWidth()) || currWS == PRE);
     2313            bool breakWords = currentStyle->breakWords() && ((autoWrap && !width.committedWidth()) || currWS == PRE);
    23112314            bool midWordBreak = false;
    2312             bool breakAll = current.m_obj->style()->wordBreak() == BreakAllWordBreak && autoWrap;
     2315            bool breakAll = currentStyle->wordBreak() == BreakAllWordBreak && autoWrap;
    23132316            float hyphenWidth = 0;
    23142317
     
    23892392                        // as candidate width for this line.
    23902393                        bool lineWasTooWide = false;
    2391                         if (width.fitsOnLine() && currentCharacterIsWS && current.m_obj->style()->breakOnlyAfterWhiteSpace() && !midWordBreak) {
     2394                        if (width.fitsOnLine() && currentCharacterIsWS && currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) {
    23922395                            float charWidth = textWidth(t, current.m_pos, 1, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace) + (applyWordSpacing ? wordSpacing : 0);
    23932396                            // Check if line is too big even without the extra space
     
    24042407                        if (lineWasTooWide || !width.fitsOnLine()) {
    24052408                            if (canHyphenate && !width.fitsOnLine()) {
    2406                                 tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, m_block->style()->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
     2409                                tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, blockStyle->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
    24072410                                if (m_hyphenated)
    24082411                                    goto end;
     
    24642467                    }
    24652468
    2466                     if (!ignoringSpaces && current.m_obj->style()->collapseWhiteSpace()) {
     2469                    if (!ignoringSpaces && currentStyle->collapseWhiteSpace()) {
    24672470                        // If we encounter a newline, or if we encounter a
    24682471                        // second space, we need to go ahead and break up this
     
    25032506
    25042507                if (!currentCharacterIsWS && previousCharacterIsWS) {
    2505                     if (autoWrap && current.m_obj->style()->breakOnlyAfterWhiteSpace())
     2508                    if (autoWrap && currentStyle->breakOnlyAfterWhiteSpace())
    25062509                        lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition);
    25072510                }
     
    25092512                if (collapseWhiteSpace && currentCharacterIsSpace && !ignoringSpaces)
    25102513                    trailingObjects.setTrailingWhitespace(toRenderText(current.m_obj));
    2511                 else if (!current.m_obj->style()->collapseWhiteSpace() || !currentCharacterIsSpace)
     2514                else if (!currentStyle->collapseWhiteSpace() || !currentCharacterIsSpace)
    25122515                    trailingObjects.clear();
    25132516
     
    25222525            if (!width.fitsOnLine()) {
    25232526                if (canHyphenate)
    2524                     tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, m_block->style()->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
     2527                    tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, blockStyle->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
    25252528
    25262529                if (!m_hyphenated && lBreak.previousInSameNode() == softHyphen && style->hyphens() != HyphensNone)
     
    25632566        if (checkForBreak && !width.fitsOnLine()) {
    25642567            // if we have floats, try to get below them.
    2565             if (currentCharacterIsSpace && !ignoringSpaces && current.m_obj->style()->collapseWhiteSpace())
     2568            if (currentCharacterIsSpace && !ignoringSpaces && currentStyle->collapseWhiteSpace())
    25662569                trailingObjects.clear();
    25672570
     
    26012604    if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR())) {
    26022605        // we just add as much as possible
    2603         if (m_block->style()->whiteSpace() == PRE) {
     2606        if (blockStyle->whiteSpace() == PRE) {
    26042607            // FIXME: Don't really understand this case.
    26052608            if (current.m_pos) {
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r105120 r105394  
    249249    clearOverrideSize();
    250250
    251     if (style() && (style()->logicalHeight().isPercent() || style()->logicalMinHeight().isPercent() || style()->logicalMaxHeight().isPercent()))
     251    RenderStyle* styleToUse = style();
     252    if (styleToUse && (styleToUse->logicalHeight().isPercent() || styleToUse->logicalMinHeight().isPercent() || styleToUse->logicalMaxHeight().isPercent()))
    252253        RenderBlock::removePercentHeightDescendant(this);
    253254
    254255    // If this renderer is owning renderer for the frameview's custom scrollbars,
    255256    // we need to clear it from the scrollbar. See webkit bug 64737.
    256     if (style() && style()->hasPseudoStyle(SCROLLBAR) && frame() && frame()->view())
     257    if (styleToUse && styleToUse->hasPseudoStyle(SCROLLBAR) && frame() && frame()->view())
    257258        frame()->view()->clearOwningRendererForCustomScrollbars(this);
    258259
     
    304305    s_hadOverflowClip = hasOverflowClip();
    305306
    306     if (style()) {
     307    RenderStyle* oldStyle = style();
     308    if (oldStyle) {
    307309        // The background of the root element or the body element could propagate up to
    308310        // the canvas.  Just dirty the entire canvas when our style changes substantially.
     
    313315        // When a layout hint happens and an object's position style changes, we have to do a layout
    314316        // to dirty the render tree using the old position value now.
    315         if (diff == StyleDifferenceLayout && parent() && style()->position() != newStyle->position()) {
     317        if (diff == StyleDifferenceLayout && parent() && oldStyle->position() != newStyle->position()) {
    316318            markContainingBlocksForLayout();
    317             if (style()->position() == StaticPosition)
     319            if (oldStyle->position() == StaticPosition)
    318320                repaint();
    319             else if (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition)
     321            else if (newStyle->isPositioned())
    320322                parent()->setChildNeedsLayout(true);
    321             if (isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition))
     323            if (isFloating() && !isPositioned() && newStyle->isPositioned())
    322324                removeFloatingOrPositionedChildFromBlockLists();
    323325        }
     
    327329    if (FrameView *frameView = view()->frameView()) {
    328330        bool newStyleIsFixed = newStyle && newStyle->position() == FixedPosition;
    329         bool oldStyleIsFixed = style() && style()->position() == FixedPosition;
     331        bool oldStyleIsFixed = oldStyle && oldStyle->position() == FixedPosition;
    330332        if (newStyleIsFixed != oldStyleIsFixed) {
    331333            if (newStyleIsFixed)
     
    343345    RenderBoxModelObject::styleDidChange(diff, oldStyle);
    344346
     347    RenderStyle* newStyle = style();
    345348    if (needsLayout() && oldStyle) {
    346349        if (oldStyle && (oldStyle->logicalHeight().isPercent() || oldStyle->logicalMinHeight().isPercent() || oldStyle->logicalMaxHeight().isPercent()))
     
    350353        // when the positioned object's margin-before is changed. In this case the parent has to get a layout in order to run margin collapsing
    351354        // to determine the new static position.
    352         if (isPositioned() && style()->hasStaticBlockPosition(isHorizontalWritingMode()) && oldStyle->marginBefore() != style()->marginBefore()
     355        if (isPositioned() && newStyle->hasStaticBlockPosition(isHorizontalWritingMode()) && oldStyle->marginBefore() != newStyle->marginBefore()
    353356            && parent() && !parent()->normalChildNeedsLayout())
    354357            parent()->setChildNeedsLayout(true);
     
    357360    // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the
    358361    // new zoomed coordinate space.
    359     if (hasOverflowClip() && oldStyle && style() && oldStyle->effectiveZoom() != style()->effectiveZoom()) {
     362    if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() != newStyle->effectiveZoom()) {
    360363        if (int left = layer()->scrollXOffset()) {
    361             left = (left / oldStyle->effectiveZoom()) * style()->effectiveZoom();
     364            left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom();
    362365            layer()->scrollToXOffset(left);
    363366        }
    364367        if (int top = layer()->scrollYOffset()) {
    365             top = (top / oldStyle->effectiveZoom()) * style()->effectiveZoom();
     368            top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom();
    366369            layer()->scrollToYOffset(top);
    367370        }
     
    373376    // Set the text color if we're the body.
    374377    if (isBodyRenderer)
    375         document()->setTextColor(style()->visitedDependentColor(CSSPropertyColor));
     378        document()->setTextColor(newStyle->visitedDependentColor(CSSPropertyColor));
    376379
    377380    if (isRootRenderer || isBodyRenderer) {
     
    379382        RenderView* viewRenderer = view();
    380383        RenderStyle* viewStyle = viewRenderer->style();
    381         if (viewStyle->direction() != style()->direction() && (isRootRenderer || !document()->directionSetOnDocumentElement())) {
    382             viewStyle->setDirection(style()->direction());
     384        if (viewStyle->direction() != newStyle->direction() && (isRootRenderer || !document()->directionSetOnDocumentElement())) {
     385            viewStyle->setDirection(newStyle->direction());
    383386            if (isBodyRenderer)
    384                 document()->documentElement()->renderer()->style()->setDirection(style()->direction());
     387                document()->documentElement()->renderer()->style()->setDirection(newStyle->direction());
    385388            setNeedsLayoutAndPrefWidthsRecalc();
    386389        }
    387390
    388         if (viewStyle->writingMode() != style()->writingMode() && (isRootRenderer || !document()->writingModeSetOnDocumentElement())) {
    389             viewStyle->setWritingMode(style()->writingMode());
    390             viewRenderer->setHorizontalWritingMode(style()->isHorizontalWritingMode());
     391        if (viewStyle->writingMode() != newStyle->writingMode() && (isRootRenderer || !document()->writingModeSetOnDocumentElement())) {
     392            viewStyle->setWritingMode(newStyle->writingMode());
     393            viewRenderer->setHorizontalWritingMode(newStyle->isHorizontalWritingMode());
    391394            if (isBodyRenderer) {
    392                 document()->documentElement()->renderer()->style()->setWritingMode(style()->writingMode());
    393                 document()->documentElement()->renderer()->setHorizontalWritingMode(style()->isHorizontalWritingMode());
     395                document()->documentElement()->renderer()->style()->setWritingMode(newStyle->writingMode());
     396                document()->documentElement()->renderer()->setHorizontalWritingMode(newStyle->isHorizontalWritingMode());
    394397            }
    395398            setNeedsLayoutAndPrefWidthsRecalc();
     
    404407    RenderBoxModelObject::updateBoxModelInfoFromStyle();
    405408
     409    RenderStyle* styleToUse = style();
    406410    bool isRootObject = isRoot();
    407411    bool isViewObject = isRenderView();
     
    411415        setHasBoxDecorations(true);
    412416
    413     setPositioned(style()->isPositioned());
    414     setFloating(style()->isFloating() && (!isPositioned() || style()->floating() == PositionedFloat));
     417    setPositioned(styleToUse->isPositioned());
     418    setFloating(styleToUse->isFloating() && (!isPositioned() || styleToUse->floating() == PositionedFloat));
    415419
    416420    // We also handle <body> and <html>, whose overflow applies to the viewport.
    417     if (style()->overflowX() != OVISIBLE && !isRootObject && (isRenderBlock() || isTableRow() || isTableSection())) {
     421    if (styleToUse->overflowX() != OVISIBLE && !isRootObject && (isRenderBlock() || isTableRow() || isTableSection())) {
    418422        bool boxHasOverflowClip = true;
    419423        if (isBody()) {
     
    438442    }
    439443
    440     setHasTransform(style()->hasTransformRelatedProperty());
    441     setHasReflection(style()->boxReflect());
     444    setHasTransform(styleToUse->hasTransformRelatedProperty());
     445    setHasReflection(styleToUse->boxReflect());
    442446}
    443447
     
    14881492    // physical when we hit a repaintContainer boundary.  Therefore the final rect returned is always in the
    14891493    // physical coordinate space of the repaintContainer.
     1494    RenderStyle* styleToUse = style();
    14901495    if (RenderView* v = view()) {
    14911496        // LayoutState is only valid for root-relative, non-fixed position repainting
    1492         if (v->layoutStateEnabled() && !repaintContainer && style()->position() != FixedPosition) {
     1497        if (v->layoutStateEnabled() && !repaintContainer && styleToUse->position() != FixedPosition) {
    14931498            LayoutState* layoutState = v->layoutState();
    14941499
     
    14961501                rect = layer()->transform()->mapRect(rect);
    14971502
    1498             if (style()->position() == RelativePosition && layer())
     1503            if (styleToUse->position() == RelativePosition && layer())
    14991504                rect.move(layer()->relativePositionOffset());
    15001505
     
    15251530
    15261531#if ENABLE(CSS_FILTERS)
    1527     if (style()->hasFilterOutsets()) {
     1532    if (styleToUse->hasFilterOutsets()) {
    15281533        LayoutUnit topOutset;
    15291534        LayoutUnit rightOutset;
    15301535        LayoutUnit bottomOutset;
    15311536        LayoutUnit leftOutset;
    1532         style()->filter().getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
     1537        styleToUse->filter().getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);
    15331538        rect.move(-leftOutset, -topOutset);
    15341539        rect.expand(leftOutset + rightOutset, topOutset + bottomOutset);
     
    15391544    topLeft.move(x(), y());
    15401545
    1541     EPosition position = style()->position();
     1546    EPosition position = styleToUse->position();
    15421547
    15431548    // We are now in our parent container's coordinate space.  Apply our transform to obtain a bounding box
     
    16501655    bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching);
    16511656
    1652     Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedLogicalWidth(), Fixed) : style()->logicalWidth();
     1657    RenderStyle* styleToUse = style();
     1658    Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedLogicalWidth(), Fixed) : styleToUse->logicalWidth();
    16531659
    16541660    RenderBlock* cb = containingBlock();
     
    16611667    if (isInline() && !isInlineBlockOrInlineTable()) {
    16621668        // just calculate margins
    1663         setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth));
    1664         setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
     1669        setMarginStart(styleToUse->marginStart().calcMinValue(containerLogicalWidth));
     1670        setMarginEnd(styleToUse->marginEnd().calcMinValue(containerLogicalWidth));
    16651671        if (treatAsReplaced)
    16661672            setLogicalWidth(max<LayoutUnit>(logicalWidthLength.calcFloatValue(0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
     
    16761682
    16771683        // Calculate MaxLogicalWidth
    1678         if (!style()->logicalMaxWidth().isUndefined()) {
     1684        if (!styleToUse->logicalMaxWidth().isUndefined()) {
    16791685            LayoutUnit maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection);
    16801686            if (logicalWidth() > maxLogicalWidth) {
    16811687                setLogicalWidth(maxLogicalWidth);
    1682                 logicalWidthLength = style()->logicalMaxWidth();
     1688                logicalWidthLength = styleToUse->logicalMaxWidth();
    16831689            }
    16841690        }
     
    16881694        if (logicalWidth() < minLogicalWidth) {
    16891695            setLogicalWidth(minLogicalWidth);
    1690             logicalWidthLength = style()->logicalMinWidth();
     1696            logicalWidthLength = styleToUse->logicalMinWidth();
    16911697        }
    16921698    }
     
    17001706    // Margin calculations.
    17011707    if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock) {
    1702         setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth));
    1703         setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
     1708        setMarginStart(styleToUse->marginStart().calcMinValue(containerLogicalWidth));
     1709        setMarginEnd(styleToUse->marginEnd().calcMinValue(containerLogicalWidth));
    17041710    } else
    17051711        computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth());
     
    17131719{
    17141720    LayoutUnit logicalWidthResult = logicalWidth();
     1721    RenderStyle* styleToUse = style();
    17151722    Length logicalWidth;
    17161723    if (widthType == LogicalWidth)
    1717         logicalWidth = style()->logicalWidth();
     1724        logicalWidth = styleToUse->logicalWidth();
    17181725    else if (widthType == MinLogicalWidth)
    1719         logicalWidth = style()->logicalMinWidth();
     1726        logicalWidth = styleToUse->logicalMinWidth();
    17201727    else
    1721         logicalWidth = style()->logicalMaxWidth();
     1728        logicalWidth = styleToUse->logicalMaxWidth();
    17221729
    17231730    if (logicalWidth.isIntrinsicOrAuto()) {
    1724         LayoutUnit marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);
    1725         LayoutUnit marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);
     1731        LayoutUnit marginStart = styleToUse->marginStart().calcMinValue(availableLogicalWidth);
     1732        LayoutUnit marginEnd = styleToUse->marginEnd().calcMinValue(availableLogicalWidth);
    17261733        logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
    17271734
     
    19561963        // FIXME: Account for block-flow in flexible boxes.
    19571964        // https://bugs.webkit.org/show_bug.cgi?id=46418
     1965        RenderStyle* styleToUse = style();
    19581966        if (hasOverrideHeight() && parent()->isFlexibleBoxIncludingDeprecated())
    19591967            h = Length(overrideHeight() - borderAndPaddingLogicalHeight(), Fixed);
     
    19611969            h = Length(computeReplacedLogicalHeight(), Fixed);
    19621970        else {
    1963             h = style()->logicalHeight();
     1971            h = styleToUse->logicalHeight();
    19641972            checkMinMaxHeight = true;
    19651973        }
     
    19761984        LayoutUnit heightResult;
    19771985        if (checkMinMaxHeight) {
    1978             heightResult = computeLogicalHeightUsing(style()->logicalHeight());
     1986            heightResult = computeLogicalHeightUsing(styleToUse->logicalHeight());
    19791987            // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148
    19801988            if (heightResult == -1)
    19811989                heightResult = logicalHeight();
    1982             LayoutUnit minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.
    1983             LayoutUnit maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight());
     1990            LayoutUnit minH = computeLogicalHeightUsing(styleToUse->logicalMinHeight()); // Leave as -1 if unset.
     1991            LayoutUnit maxH = styleToUse->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(styleToUse->logicalMaxHeight());
    19841992            if (maxH == -1)
    19851993                maxH = heightResult;
     
    20642072    }
    20652073
     2074    RenderStyle* cbstyle = cb->style();
     2075
    20662076    // A positioned element that specified both top/bottom or that specifies height should be treated as though it has a height
    20672077    // explicitly specified that can be used for any percentage computations.
    20682078    // FIXME: We can't just check top/bottom here.
    20692079    // https://bugs.webkit.org/show_bug.cgi?id=46500
    2070     bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto()));
     2080    bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->top().isAuto() && !cbstyle->bottom().isAuto()));
    20712081
    20722082    bool includeBorderPadding = isTable();
     
    20962106    // Otherwise we only use our percentage height if our containing block had a specified
    20972107    // height.
    2098     else if (cb->style()->logicalHeight().isFixed())
    2099         result = cb->computeContentBoxLogicalHeight(cb->style()->logicalHeight().value());
    2100     else if (cb->style()->logicalHeight().isPercent() && !isPositionedWithSpecifiedHeight) {
     2108    else if (cbstyle->logicalHeight().isFixed())
     2109        result = cb->computeContentBoxLogicalHeight(cbstyle->logicalHeight().value());
     2110    else if (cbstyle->logicalHeight().isPercent() && !isPositionedWithSpecifiedHeight) {
    21012111        // We need to recur and compute the percentage height for our containing block.
    2102         result = cb->computePercentageLogicalHeight(cb->style()->logicalHeight());
     2112        result = cb->computePercentageLogicalHeight(cbstyle->logicalHeight());
    21032113        // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148
    21042114        if (result != -1)
     
    28072817
    28082818    bool isHorizontal = isHorizontalWritingMode();
    2809     bool isFlipped = style()->isFlippedBlocksWritingMode();
     2819    RenderStyle* styleToUse = style();
     2820    bool isFlipped = styleToUse->isFlippedBlocksWritingMode();
    28102821    const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight();
    2811     const Length marginBefore = style()->marginBefore();
    2812     const Length marginAfter = style()->marginAfter();
     2822    const Length marginBefore = styleToUse->marginBefore();
     2823    const Length marginAfter = styleToUse->marginAfter();
    28132824    LayoutUnit& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft);
    28142825    LayoutUnit& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight);
    28152826
    2816     Length logicalTopLength = style()->logicalTop();
    2817     Length logicalBottomLength = style()->logicalBottom();
     2827    Length logicalTopLength = styleToUse->logicalTop();
     2828    Length logicalBottomLength = styleToUse->logicalBottom();
    28182829       
    28192830    /*---------------------------------------------------------------------------*\
     
    28422853
    28432854    // Calculate constraint equation values for 'height' case.
    2844     computePositionedLogicalHeightUsing(style()->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
     2855    computePositionedLogicalHeightUsing(styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
    28452856                                        logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
    28462857                                        logicalHeightResult, marginBeforeAlias, marginAfterAlias, logicalTopPos);
     
    28512862
    28522863    // Calculate constraint equation values for 'max-height' case.
    2853     if (!style()->logicalMaxHeight().isUndefined()) {
     2864    if (!styleToUse->logicalMaxHeight().isUndefined()) {
    28542865        LayoutUnit maxLogicalHeight;
    28552866        LayoutUnit maxMarginBefore;
     
    28572868        LayoutUnit maxLogicalTopPos;
    28582869
    2859         computePositionedLogicalHeightUsing(style()->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
     2870        computePositionedLogicalHeightUsing(styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
    28602871                                            logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
    28612872                                            maxLogicalHeight, maxMarginBefore, maxMarginAfter, maxLogicalTopPos);
     
    28702881
    28712882    // Calculate constraint equation values for 'min-height' case.
    2872     if (!style()->logicalMinHeight().isZero()) {
     2883    if (!styleToUse->logicalMinHeight().isZero()) {
    28732884        LayoutUnit minLogicalHeight;
    28742885        LayoutUnit minMarginBefore;
     
    28762887        LayoutUnit minLogicalTopPos;
    28772888
    2878         computePositionedLogicalHeightUsing(style()->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
     2889        computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
    28792890                                            logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
    28802891                                            minLogicalHeight, minMarginBefore, minMarginAfter, minLogicalTopPos);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r104851 r105394  
    312312    // If our z-index changes value or our visibility changes,
    313313    // we need to dirty our stacking context's z-order list.
    314     if (style() && newStyle) {
     314    RenderStyle* oldStyle = style();
     315    if (oldStyle && newStyle) {
    315316        if (parent()) {
    316317            // Do a repaint with the old style first, e.g., for example if we go from
     
    318319            if (diff == StyleDifferenceRepaintLayer) {
    319320                layer()->repaintIncludingDescendants();
    320                 if (!(style()->clip() == newStyle->clip()))
     321                if (!(oldStyle->clip() == newStyle->clip()))
    321322                    layer()->clearClipRectsIncludingDescendants();
    322             } else if (diff == StyleDifferenceRepaint || newStyle->outlineSize() < style()->outlineSize())
     323            } else if (diff == StyleDifferenceRepaint || newStyle->outlineSize() < oldStyle->outlineSize())
    323324                repaint();
    324325        }
     
    328329            // end up being destroyed.
    329330            if (hasLayer()) {
    330                 if (style()->position() != newStyle->position() ||
    331                     style()->zIndex() != newStyle->zIndex() ||
    332                     style()->hasAutoZIndex() != newStyle->hasAutoZIndex() ||
    333                     !(style()->clip() == newStyle->clip()) ||
    334                     style()->hasClip() != newStyle->hasClip() ||
    335                     style()->opacity() != newStyle->opacity() ||
    336                     style()->transform() != newStyle->transform())
     331                if (oldStyle->position() != newStyle->position()
     332                    || oldStyle->zIndex() != newStyle->zIndex()
     333                    || oldStyle->hasAutoZIndex() != newStyle->hasAutoZIndex()
     334                    || !(oldStyle->clip() == newStyle->clip())
     335                    || oldStyle->hasClip() != newStyle->hasClip()
     336                    || oldStyle->opacity() != newStyle->opacity()
     337                    || oldStyle->transform() != newStyle->transform())
    337338                layer()->repaintIncludingDescendants();
    338339            } else if (newStyle->hasTransform() || newStyle->opacity() < 1) {
     
    343344        }
    344345
    345         if (hasLayer() && (style()->hasAutoZIndex() != newStyle->hasAutoZIndex() ||
    346                            style()->zIndex() != newStyle->zIndex() ||
    347                            style()->visibility() != newStyle->visibility())) {
     346        if (hasLayer()
     347            && (oldStyle->hasAutoZIndex() != newStyle->hasAutoZIndex()
     348                || oldStyle->zIndex() != newStyle->zIndex()
     349                || oldStyle->visibility() != newStyle->visibility())) {
    348350            layer()->dirtyStackingContextZOrderLists();
    349             if (style()->hasAutoZIndex() != newStyle->hasAutoZIndex() || style()->visibility() != newStyle->visibility())
     351            if (oldStyle->hasAutoZIndex() != newStyle->hasAutoZIndex() || oldStyle->visibility() != newStyle->visibility())
    350352                layer()->dirtyZOrderLists();
    351353        }
     
    393395    // Set the appropriate bits for a box model object.  Since all bits are cleared in styleWillChange,
    394396    // we only check for bits that could possibly be set to true.
    395     setHasBoxDecorations(hasBackground() || style()->hasBorder() || style()->hasAppearance() || style()->boxShadow());
    396     setInline(style()->isDisplayInlineType());
    397     setRelPositioned(style()->position() == RelativePosition);
    398     setHorizontalWritingMode(style()->isHorizontalWritingMode());
     397    RenderStyle* styleToUse = style();
     398    setHasBoxDecorations(hasBackground() || styleToUse->hasBorder() || styleToUse->hasAppearance() || styleToUse->boxShadow());
     399    setInline(styleToUse->isDisplayInlineType());
     400    setRelPositioned(styleToUse->position() == RelativePosition);
     401    setHorizontalWritingMode(styleToUse->isHorizontalWritingMode());
    399402}
    400403
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r104802 r105394  
    138138    // and after the block share the same style, but the block doesn't
    139139    // need to pass its style on to anyone else.
     140    RenderStyle* newStyle = style();
    140141    for (RenderInline* currCont = inlineElementContinuation(); currCont; currCont = currCont->inlineElementContinuation()) {
    141142        RenderBoxModelObject* nextCont = currCont->continuation();
    142143        currCont->setContinuation(0);
    143         currCont->setStyle(style());
     144        currCont->setStyle(newStyle);
    144145        currCont->setContinuation(nextCont);
    145146    }
     
    148149
    149150    if (!m_alwaysCreateLineBoxes) {
    150         bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || style()->hasPadding() || style()->hasMargin() || hasOutline();
     151        bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || newStyle->hasPadding() || newStyle->hasMargin() || hasOutline();
    151152        if (oldStyle && alwaysCreateLineBoxes) {
    152153            dirtyLineBoxes(false);
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r104552 r105394  
    190190    }
    191191
     192    RenderStyle* newStyle = style();
    192193    bool needsResetText = false;
    193194    if (!oldStyle) {
    194195        updateNeedsTranscoding();
    195196        needsResetText = m_needsTranscoding;
    196     } else if (oldStyle->font().needsTranscoding() != style()->font().needsTranscoding() || (style()->font().needsTranscoding() && oldStyle->font().family().family() != style()->font().family().family())) {
     197    } else if (oldStyle->font().needsTranscoding() != newStyle->font().needsTranscoding() || (newStyle->font().needsTranscoding() && oldStyle->font().family().family() != newStyle->font().family().family())) {
    197198        updateNeedsTranscoding();
    198199        needsResetText = true;
     
    201202    ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE;
    202203    ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE;
    203     if (needsResetText || oldTransform != style()->textTransform() || oldSecurity != style()->textSecurity()) {
     204    if (needsResetText || oldTransform != newStyle->textTransform() || oldSecurity != newStyle->textSecurity()) {
    204205        if (RefPtr<StringImpl> textToTransform = originalText())
    205206            setText(textToTransform.release(), true);
     
    906907    m_hasEndWS = false;
    907908
    908     const Font& f = style()->font(); // FIXME: This ignores first-line.
    909     float wordSpacing = style()->wordSpacing();
     909    RenderStyle* styleToUse = style();
     910    const Font& f = styleToUse->font(); // FIXME: This ignores first-line.
     911    float wordSpacing = styleToUse->wordSpacing();
    910912    int len = textLength();
    911913    const UChar* txt = characters();
    912     LazyLineBreakIterator breakIterator(txt, len, style()->locale());
     914    LazyLineBreakIterator breakIterator(txt, len, styleToUse->locale());
    913915    bool needsWordSpacing = false;
    914916    bool ignoringSpaces = false;
     
    921923    // Non-zero only when kerning is enabled, in which case we measure words with their trailing
    922924    // space, then subtract its width.
    923     float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, style())) : 0;
     925    float wordTrailingSpaceWidth = f.typesettingFeatures() & Kerning ? f.width(RenderBlock::constructTextRun(this, f, &space, 1, styleToUse)) : 0;
    924926
    925927    int firstGlyphLeftOverflow = -1;
    926928
    927     bool breakNBSP = style()->autoWrap() && style()->nbspMode() == SPACE;
    928     bool breakAll = (style()->wordBreak() == BreakAllWordBreak || style()->wordBreak() == BreakWordBreak) && style()->autoWrap();
     929    bool breakNBSP = styleToUse->autoWrap() && styleToUse->nbspMode() == SPACE;
     930    bool breakAll = (styleToUse->wordBreak() == BreakAllWordBreak || styleToUse->wordBreak() == BreakWordBreak) && styleToUse->autoWrap();
    929931
    930932    for (int i = 0; i < len; i++) {
     
    935937        bool isNewline = false;
    936938        if (c == '\n') {
    937             if (style()->preserveNewline()) {
     939            if (styleToUse->preserveNewline()) {
    938940                m_hasBreak = true;
    939941                isNewline = true;
     
    942944                isSpace = true;
    943945        } else if (c == '\t') {
    944             if (!style()->collapseWhiteSpace()) {
     946            if (!styleToUse->collapseWhiteSpace()) {
    945947                m_hasTab = true;
    946948                isSpace = false;
     
    955957            m_hasEndWS = true;
    956958
    957         if (!ignoringSpaces && style()->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
     959        if (!ignoringSpaces && styleToUse->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)
    958960            ignoringSpaces = true;
    959961
     
    977979        bool betweenWords = true;
    978980        int j = i;
    979         while (c != '\n' && !isSpaceAccordingToStyle(c, style()) && c != '\t' && c != softHyphen) {
     981        while (c != '\n' && !isSpaceAccordingToStyle(c, styleToUse) && c != '\t' && c != softHyphen) {
    980982            j++;
    981983            if (j == len)
     
    992994        int wordLen = j - i;
    993995        if (wordLen) {
    994             bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style());
     996            bool isSpace = (j < len) && isSpaceAccordingToStyle(c, styleToUse);
    995997            float w;
    996998            if (wordTrailingSpaceWidth && isSpace)
     
    10101012            }
    10111013
    1012             bool isCollapsibleWhiteSpace = (j < len) && style()->isCollapsibleWhiteSpace(c);
    1013             if (j < len && style()->autoWrap())
     1014            bool isCollapsibleWhiteSpace = (j < len) && styleToUse->isCollapsibleWhiteSpace(c);
     1015            if (j < len && styleToUse->autoWrap())
    10141016                m_hasBreakableChar = true;
    10151017
     
    10491051                    firstLine = false;
    10501052                    leadWidth = 0;
    1051                     if (!style()->autoWrap())
     1053                    if (!styleToUse->autoWrap())
    10521054                        m_beginMinWidth = currMaxWidth;
    10531055                }
     
    10571059                currMaxWidth = 0;
    10581060            } else {
    1059                 TextRun run = RenderBlock::constructTextRun(this, f, txt + i, 1, style());
     1061                TextRun run = RenderBlock::constructTextRun(this, f, txt + i, 1, styleToUse);
    10601062                run.setCharactersLength(len - i);
    10611063                ASSERT(run.charactersLength() >= run.length());
     
    10821084    m_maxWidth = max(currMaxWidth, m_maxWidth);
    10831085
    1084     if (!style()->autoWrap())
     1086    if (!styleToUse->autoWrap())
    10851087        m_minWidth = m_maxWidth;
    10861088
    1087     if (style()->whiteSpace() == PRE) {
     1089    if (styleToUse->whiteSpace() == PRE) {
    10881090        if (firstLine)
    10891091            m_beginMinWidth = m_maxWidth;
Note: See TracChangeset for help on using the changeset viewer.