Changeset 105394 in webkit
- Timestamp:
- Jan 19, 2012 1:22:59 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r105393 r105394 1 2012-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 1 46 2012-01-19 Kazuhiro Inaba <kinaba@chromium.org> 2 47 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r105176 r105394 97 97 // if we had any border/padding (obviously), if we're the root or HTML elements, or if 98 98 // we're positioned, floating, a table cell. 99 RenderStyle* blockStyle = block->style(); 99 100 m_canCollapseWithChildren = !block->isRenderView() && !block->isRoot() && !block->isPositioned() 100 101 && !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; 105 106 106 107 // If any height other than auto is specified in CSS, then we don't collapse our bottom … … 109 110 // with it. We also don't collapse if we have any bottom border/padding. 110 111 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; 115 116 116 117 m_positiveMargin = m_canCollapseMarginBeforeWithChildren ? block->maxPositiveMarginBefore() : 0; … … 210 211 void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) 211 212 { 212 s_canPropagateFloatIntoSibling = style() ? !isFloatingOrPositioned() && !avoidsFloats() : false; 213 RenderStyle* oldStyle = style(); 214 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrPositioned() && !avoidsFloats() : false; 213 215 214 216 setReplaced(newStyle->isDisplayInlineType()); 215 217 216 if ( style() && parent() && diff == StyleDifferenceLayout && style()->position() != newStyle->position()) {218 if (oldStyle && parent() && diff == StyleDifferenceLayout && oldStyle->position() != newStyle->position()) { 217 219 if (newStyle->position() == StaticPosition) 218 220 // Clear our positioned objects list. Our absolutely positioned descendants will be 219 221 // inserted into our containing block's positioned objects list during layout. 220 222 removePositionedObjects(0); 221 else if ( style()->position() == StaticPosition) {223 else if (oldStyle->position() == StaticPosition) { 222 224 // Remove our absolutely positioned descendants from their current containing block. 223 225 // They will be inserted into our positioned objects list during layout. … … 1250 1252 1251 1253 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); 1253 1256 1254 1257 if (inRenderFlowThread()) { … … 1282 1285 initMaxMarginValues(); 1283 1286 1284 setMarginBeforeQuirk(style ()->marginBefore().quirk());1285 setMarginAfterQuirk(style ()->marginAfter().quirk());1287 setMarginBeforeQuirk(styleToUse->marginBefore().quirk()); 1288 setMarginAfterQuirk(styleToUse->marginAfter().quirk()); 1286 1289 1287 1290 Node* n = node(); … … 1297 1300 // For overflow:scroll blocks, ensure we have both scrollbars in place always. 1298 1301 if (scrollsOverflow()) { 1299 if (style ()->overflowX() == OSCROLL)1302 if (styleToUse->overflowX() == OSCROLL) 1300 1303 layer()->setHasHorizontalScrollbar(true); 1301 if (style ()->overflowY() == OSCROLL)1304 if (styleToUse->overflowY() == OSCROLL) 1302 1305 layer()->setHasVerticalScrollbar(true); 1303 1306 } … … 1364 1367 // Repaint with our new bounds if they are different from our old bounds. 1365 1368 bool didFullRepaint = repainter.repaintAfterLayout(); 1366 if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (style ()->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) {1369 if (!didFullRepaint && repaintLogicalTop != repaintLogicalBottom && (styleToUse->visibility() == VISIBLE || enclosingLayer()->hasVisibleContent())) { 1367 1370 // FIXME: We could tighten up the left and right invalidation points if we let layoutInlineChildren fill them in based off the particular lines 1368 1371 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that case either. … … 2019 2022 // FIXME: Technically percentage height objects only need a relayout if their percentage isn't going to be turned into 2020 2023 // 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())) 2022 2026 child->setChildNeedsLayout(true, false); 2023 2027 … … 2049 2053 2050 2054 // 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) { 2052 2057 marginInfo.setAtBeforeSideOfBlock(false); 2053 2058 marginInfo.clearMargin(); … … 2145 2150 // Update our height now that the child has been placed in the correct position. 2146 2151 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); 2147 if (child ->style()->marginAfterCollapse() == MSEPARATE) {2152 if (childStyle->marginAfterCollapse() == MSEPARATE) { 2148 2153 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); 2149 2154 marginInfo.clearMargin(); … … 4943 4948 updateFirstLetter(); 4944 4949 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()); 4947 4953 else { 4948 4954 m_minPreferredLogicalWidth = 0; … … 4956 4962 m_maxPreferredLogicalWidth = max(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 4957 4963 4958 if (!style ()->autoWrap() && childrenInline()) {4964 if (!styleToUse->autoWrap() && childrenInline()) { 4959 4965 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; 4960 4966 … … 4965 4971 4966 4972 int scrollbarWidth = 0; 4967 if (hasOverflowClip() && style ()->overflowY() == OSCROLL) {4973 if (hasOverflowClip() && styleToUse->overflowY() == OSCROLL) { 4968 4974 layer()->setHasVerticalScrollbar(true); 4969 4975 scrollbarWidth = verticalScrollbarWidth(); … … 4982 4988 } 4983 4989 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())); 4992 4998 } 4993 4999 … … 5072 5078 static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfInline) 5073 5079 { 5074 RenderStyle* c style = child->style();5080 RenderStyle* childStyle = child->style(); 5075 5081 if (endOfInline) 5076 return getBPMWidth(child->marginEnd(), c style->marginEnd()) +5077 getBPMWidth(child->paddingEnd(), c style->paddingEnd()) +5082 return getBPMWidth(child->marginEnd(), childStyle->marginEnd()) + 5083 getBPMWidth(child->paddingEnd(), childStyle->paddingEnd()) + 5078 5084 child->borderEnd(); 5079 return getBPMWidth(child->marginStart(), c style->marginStart()) +5080 getBPMWidth(child->paddingStart(), c style->paddingStart()) +5085 return getBPMWidth(child->marginStart(), childStyle->marginStart()) + 5086 getBPMWidth(child->paddingStart(), childStyle->paddingStart()) + 5081 5087 child->borderStart(); 5082 5088 } … … 5108 5114 float inlineMin = 0; 5109 5115 5116 RenderStyle* styleToUse = style(); 5110 5117 RenderBlock* containingBlock = this->containingBlock(); 5111 5118 LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : 0; … … 5119 5126 // very specific cirucumstances (in order to match common WinIE renderings). 5120 5127 // 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(); 5122 5129 5123 5130 bool autoWrap, oldAutoWrap; 5124 autoWrap = oldAutoWrap = style ()->autoWrap();5131 autoWrap = oldAutoWrap = styleToUse->autoWrap(); 5125 5132 5126 5133 InlineMinMaxIterator childIterator(this); … … 5167 5174 // the width of the last non-breakable run and use that to start a new line 5168 5175 // (unless we end in whitespace). 5169 RenderStyle* c style = child->style();5176 RenderStyle* childStyle = child->style(); 5170 5177 float childMin = 0; 5171 5178 float childMax = 0; … … 5187 5194 // Inline replaced elts add in their margins to their min/max values. 5188 5195 float margins = 0; 5189 Length startMargin = c style->marginStart();5190 Length endMargin = c style->marginEnd();5196 Length startMargin = childStyle->marginStart(); 5197 Length endMargin = childStyle->marginEnd(); 5191 5198 if (startMargin.isFixed()) 5192 5199 margins += startMargin.value(); … … 5208 5215 if (child->isFloating()) { 5209 5216 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)))); 5212 5219 prevFloat = child; 5213 5220 } else … … 5230 5237 if (!addedTextIndent) { 5231 5238 addedTextIndent = true; 5232 ti = style ()->textIndent().calcMinValue(cw);5239 ti = styleToUse->textIndent().calcMinValue(cw); 5233 5240 childMin += ti; 5234 5241 childMax += ti; … … 5301 5308 if (!addedTextIndent) { 5302 5309 addedTextIndent = true; 5303 ti = style ()->textIndent().calcMinValue(cw);5310 ti = styleToUse->textIndent().calcMinValue(cw); 5304 5311 childMin+=ti; beginMin += ti; 5305 5312 childMax+=ti; beginMax += ti; … … 5359 5366 } 5360 5367 5361 if (style ()->collapseWhiteSpace())5368 if (styleToUse->collapseWhiteSpace()) 5362 5369 stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild); 5363 5370 … … 5371 5378 void RenderBlock::computeBlockPreferredLogicalWidths() 5372 5379 { 5373 bool nowrap = style()->whiteSpace() == NOWRAP; 5380 RenderStyle* styleToUse = style(); 5381 bool nowrap = styleToUse->whiteSpace() == NOWRAP; 5374 5382 5375 5383 RenderObject* child = firstChild(); … … 5383 5391 } 5384 5392 5393 RenderStyle* childStyle = child->style(); 5385 5394 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) { 5386 5395 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; 5387 if (child ->style()->clear() & CLEFT) {5396 if (childStyle->clear() & CLEFT) { 5388 5397 m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth); 5389 5398 floatLeftWidth = 0; 5390 5399 } 5391 if (child ->style()->clear() & CRIGHT) {5400 if (childStyle->clear() & CRIGHT) { 5392 5401 m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth); 5393 5402 floatRightWidth = 0; … … 5398 5407 // Auto and percentage margins simply become 0 when computing min/max width. 5399 5408 // 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); 5402 5411 LayoutUnit margin = 0; 5403 5412 LayoutUnit marginStart = 0; … … 5436 5445 // margins of the object. For negative margins, we will attempt to overlap the float if the negative margin 5437 5446 // is smaller than the float width. 5438 bool ltr = containingBlock ? containingBlock->style()->isLeftToRightDirection() : style ()->isLeftToRightDirection();5447 bool ltr = containingBlock ? containingBlock->style()->isLeftToRightDirection() : styleToUse->isLeftToRightDirection(); 5439 5448 LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd; 5440 5449 LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart; … … 5450 5459 5451 5460 if (child->isFloating()) { 5452 if (style ()->floating() == LeftFloat)5461 if (styleToUse->floating() == LeftFloat) 5453 5462 floatLeftWidth += w; 5454 5463 else -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r105176 r105394 1211 1211 void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines) 1212 1212 { 1213 RenderStyle* styleToUse = style(); 1213 1214 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated(); 1214 1215 LineMidpointState& lineMidpointState = resolver.midpointState(); … … 1255 1256 lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status()); 1256 1257 } 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(); 1261 1262 determineParagraphDirection(direction, resolver.position()); 1262 resolver.setStatus(BidiStatus(direction, style ()->unicodeBidi() == Override));1263 resolver.setStatus(BidiStatus(direction, styleToUse->unicodeBidi() == Override)); 1263 1264 } 1264 1265 // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine. … … 2132 2133 // very specific circumstances (in order to match common WinIE renderings). 2133 2134 // 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(); 2137 2139 EWhiteSpace lastWS = currWS; 2138 2140 while (current.m_obj) { 2141 RenderStyle* currentStyle = current.m_obj->style(); 2139 2142 RenderObject* next = bidiNextSkippingEmptyInlines(m_block, current.m_obj); 2140 2143 if (next && next->parent() && !next->parent()->isDescendantOf(current.m_obj->parent())) 2141 2144 includeEndWidth = true; 2142 2145 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(); 2144 2147 lastWS = last->isReplaced() ? last->parent()->style()->whiteSpace() : last->style()->whiteSpace(); 2145 2148 … … 2171 2174 2172 2175 if (!lineInfo.isEmpty()) 2173 m_clear = current .m_obj->style()->clear();2176 m_clear = currentStyle->clear(); 2174 2177 } 2175 2178 goto end; … … 2231 2234 addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Stop ignoring spaces. 2232 2235 addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Start ignoring again. 2233 } else if ( m_block->style()->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj2236 } else if (blockStyle->collapseWhiteSpace() && resolver.position().m_obj == current.m_obj 2234 2237 && shouldSkipWhitespaceAfterStartObject(m_block, current.m_obj, lineMidpointState)) { 2235 2238 // Like with list markers, we start ignoring spaces to make sure that any … … 2264 2267 LayoutUnit replacedLogicalWidth = m_block->logicalWidthForChild(replacedBox) + m_block->marginStartForChild(replacedBox) + m_block->marginEndForChild(replacedBox) + inlineLogicalWidth(current.m_obj); 2265 2268 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)) { 2267 2270 // Like with inline flows, we start ignoring spaces to make sure that any 2268 2271 // additional spaces we see will be discarded. … … 2296 2299 2297 2300 int lastSpace = current.m_pos; 2298 float wordSpacing = current .m_obj->style()->wordSpacing();2301 float wordSpacing = currentStyle->wordSpacing(); 2299 2302 float lastSpaceWordSpacing = 0; 2300 2303 … … 2305 2308 float wrapW = width.uncommittedWidth() + inlineLogicalWidth(current.m_obj, !appliedStartWidth, true); 2306 2309 float charWidth = 0; 2307 bool breakNBSP = autoWrap && current .m_obj->style()->nbspMode() == SPACE;2310 bool breakNBSP = autoWrap && currentStyle->nbspMode() == SPACE; 2308 2311 // Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word, 2309 2312 // 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); 2311 2314 bool midWordBreak = false; 2312 bool breakAll = current .m_obj->style()->wordBreak() == BreakAllWordBreak && autoWrap;2315 bool breakAll = currentStyle->wordBreak() == BreakAllWordBreak && autoWrap; 2313 2316 float hyphenWidth = 0; 2314 2317 … … 2389 2392 // as candidate width for this line. 2390 2393 bool lineWasTooWide = false; 2391 if (width.fitsOnLine() && currentCharacterIsWS && current .m_obj->style()->breakOnlyAfterWhiteSpace() && !midWordBreak) {2394 if (width.fitsOnLine() && currentCharacterIsWS && currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) { 2392 2395 float charWidth = textWidth(t, current.m_pos, 1, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace) + (applyWordSpacing ? wordSpacing : 0); 2393 2396 // Check if line is too big even without the extra space … … 2404 2407 if (lineWasTooWide || !width.fitsOnLine()) { 2405 2408 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); 2407 2410 if (m_hyphenated) 2408 2411 goto end; … … 2464 2467 } 2465 2468 2466 if (!ignoringSpaces && current .m_obj->style()->collapseWhiteSpace()) {2469 if (!ignoringSpaces && currentStyle->collapseWhiteSpace()) { 2467 2470 // If we encounter a newline, or if we encounter a 2468 2471 // second space, we need to go ahead and break up this … … 2503 2506 2504 2507 if (!currentCharacterIsWS && previousCharacterIsWS) { 2505 if (autoWrap && current .m_obj->style()->breakOnlyAfterWhiteSpace())2508 if (autoWrap && currentStyle->breakOnlyAfterWhiteSpace()) 2506 2509 lBreak.moveTo(current.m_obj, current.m_pos, current.m_nextBreakablePosition); 2507 2510 } … … 2509 2512 if (collapseWhiteSpace && currentCharacterIsSpace && !ignoringSpaces) 2510 2513 trailingObjects.setTrailingWhitespace(toRenderText(current.m_obj)); 2511 else if (!current .m_obj->style()->collapseWhiteSpace() || !currentCharacterIsSpace)2514 else if (!currentStyle->collapseWhiteSpace() || !currentCharacterIsSpace) 2512 2515 trailingObjects.clear(); 2513 2516 … … 2522 2525 if (!width.fitsOnLine()) { 2523 2526 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); 2525 2528 2526 2529 if (!m_hyphenated && lBreak.previousInSameNode() == softHyphen && style->hyphens() != HyphensNone) … … 2563 2566 if (checkForBreak && !width.fitsOnLine()) { 2564 2567 // if we have floats, try to get below them. 2565 if (currentCharacterIsSpace && !ignoringSpaces && current .m_obj->style()->collapseWhiteSpace())2568 if (currentCharacterIsSpace && !ignoringSpaces && currentStyle->collapseWhiteSpace()) 2566 2569 trailingObjects.clear(); 2567 2570 … … 2601 2604 if (lBreak == resolver.position() && (!lBreak.m_obj || !lBreak.m_obj->isBR())) { 2602 2605 // we just add as much as possible 2603 if ( m_block->style()->whiteSpace() == PRE) {2606 if (blockStyle->whiteSpace() == PRE) { 2604 2607 // FIXME: Don't really understand this case. 2605 2608 if (current.m_pos) { -
trunk/Source/WebCore/rendering/RenderBox.cpp
r105120 r105394 249 249 clearOverrideSize(); 250 250 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())) 252 253 RenderBlock::removePercentHeightDescendant(this); 253 254 254 255 // If this renderer is owning renderer for the frameview's custom scrollbars, 255 256 // 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()) 257 258 frame()->view()->clearOwningRendererForCustomScrollbars(this); 258 259 … … 304 305 s_hadOverflowClip = hasOverflowClip(); 305 306 306 if (style()) { 307 RenderStyle* oldStyle = style(); 308 if (oldStyle) { 307 309 // The background of the root element or the body element could propagate up to 308 310 // the canvas. Just dirty the entire canvas when our style changes substantially. … … 313 315 // When a layout hint happens and an object's position style changes, we have to do a layout 314 316 // 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()) { 316 318 markContainingBlocksForLayout(); 317 if ( style()->position() == StaticPosition)319 if (oldStyle->position() == StaticPosition) 318 320 repaint(); 319 else if (newStyle-> position() == AbsolutePosition || newStyle->position() == FixedPosition)321 else if (newStyle->isPositioned()) 320 322 parent()->setChildNeedsLayout(true); 321 if (isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition))323 if (isFloating() && !isPositioned() && newStyle->isPositioned()) 322 324 removeFloatingOrPositionedChildFromBlockLists(); 323 325 } … … 327 329 if (FrameView *frameView = view()->frameView()) { 328 330 bool newStyleIsFixed = newStyle && newStyle->position() == FixedPosition; 329 bool oldStyleIsFixed = style() && style()->position() == FixedPosition;331 bool oldStyleIsFixed = oldStyle && oldStyle->position() == FixedPosition; 330 332 if (newStyleIsFixed != oldStyleIsFixed) { 331 333 if (newStyleIsFixed) … … 343 345 RenderBoxModelObject::styleDidChange(diff, oldStyle); 344 346 347 RenderStyle* newStyle = style(); 345 348 if (needsLayout() && oldStyle) { 346 349 if (oldStyle && (oldStyle->logicalHeight().isPercent() || oldStyle->logicalMinHeight().isPercent() || oldStyle->logicalMaxHeight().isPercent())) … … 350 353 // 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 351 354 // 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() 353 356 && parent() && !parent()->normalChildNeedsLayout()) 354 357 parent()->setChildNeedsLayout(true); … … 357 360 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the 358 361 // new zoomed coordinate space. 359 if (hasOverflowClip() && oldStyle && style() && oldStyle->effectiveZoom() != style()->effectiveZoom()) {362 if (hasOverflowClip() && oldStyle && newStyle && oldStyle->effectiveZoom() != newStyle->effectiveZoom()) { 360 363 if (int left = layer()->scrollXOffset()) { 361 left = (left / oldStyle->effectiveZoom()) * style()->effectiveZoom();364 left = (left / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); 362 365 layer()->scrollToXOffset(left); 363 366 } 364 367 if (int top = layer()->scrollYOffset()) { 365 top = (top / oldStyle->effectiveZoom()) * style()->effectiveZoom();368 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); 366 369 layer()->scrollToYOffset(top); 367 370 } … … 373 376 // Set the text color if we're the body. 374 377 if (isBodyRenderer) 375 document()->setTextColor( style()->visitedDependentColor(CSSPropertyColor));378 document()->setTextColor(newStyle->visitedDependentColor(CSSPropertyColor)); 376 379 377 380 if (isRootRenderer || isBodyRenderer) { … … 379 382 RenderView* viewRenderer = view(); 380 383 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()); 383 386 if (isBodyRenderer) 384 document()->documentElement()->renderer()->style()->setDirection( style()->direction());387 document()->documentElement()->renderer()->style()->setDirection(newStyle->direction()); 385 388 setNeedsLayoutAndPrefWidthsRecalc(); 386 389 } 387 390 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()); 391 394 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()); 394 397 } 395 398 setNeedsLayoutAndPrefWidthsRecalc(); … … 404 407 RenderBoxModelObject::updateBoxModelInfoFromStyle(); 405 408 409 RenderStyle* styleToUse = style(); 406 410 bool isRootObject = isRoot(); 407 411 bool isViewObject = isRenderView(); … … 411 415 setHasBoxDecorations(true); 412 416 413 setPositioned(style ()->isPositioned());414 setFloating(style ()->isFloating() && (!isPositioned() || style()->floating() == PositionedFloat));417 setPositioned(styleToUse->isPositioned()); 418 setFloating(styleToUse->isFloating() && (!isPositioned() || styleToUse->floating() == PositionedFloat)); 415 419 416 420 // 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())) { 418 422 bool boxHasOverflowClip = true; 419 423 if (isBody()) { … … 438 442 } 439 443 440 setHasTransform(style ()->hasTransformRelatedProperty());441 setHasReflection(style ()->boxReflect());444 setHasTransform(styleToUse->hasTransformRelatedProperty()); 445 setHasReflection(styleToUse->boxReflect()); 442 446 } 443 447 … … 1488 1492 // physical when we hit a repaintContainer boundary. Therefore the final rect returned is always in the 1489 1493 // physical coordinate space of the repaintContainer. 1494 RenderStyle* styleToUse = style(); 1490 1495 if (RenderView* v = view()) { 1491 1496 // 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) { 1493 1498 LayoutState* layoutState = v->layoutState(); 1494 1499 … … 1496 1501 rect = layer()->transform()->mapRect(rect); 1497 1502 1498 if (style ()->position() == RelativePosition && layer())1503 if (styleToUse->position() == RelativePosition && layer()) 1499 1504 rect.move(layer()->relativePositionOffset()); 1500 1505 … … 1525 1530 1526 1531 #if ENABLE(CSS_FILTERS) 1527 if (style ()->hasFilterOutsets()) {1532 if (styleToUse->hasFilterOutsets()) { 1528 1533 LayoutUnit topOutset; 1529 1534 LayoutUnit rightOutset; 1530 1535 LayoutUnit bottomOutset; 1531 1536 LayoutUnit leftOutset; 1532 style ()->filter().getOutsets(topOutset, rightOutset, bottomOutset, leftOutset);1537 styleToUse->filter().getOutsets(topOutset, rightOutset, bottomOutset, leftOutset); 1533 1538 rect.move(-leftOutset, -topOutset); 1534 1539 rect.expand(leftOutset + rightOutset, topOutset + bottomOutset); … … 1539 1544 topLeft.move(x(), y()); 1540 1545 1541 EPosition position = style ()->position();1546 EPosition position = styleToUse->position(); 1542 1547 1543 1548 // We are now in our parent container's coordinate space. Apply our transform to obtain a bounding box … … 1650 1655 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching); 1651 1656 1652 Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedLogicalWidth(), Fixed) : style()->logicalWidth(); 1657 RenderStyle* styleToUse = style(); 1658 Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedLogicalWidth(), Fixed) : styleToUse->logicalWidth(); 1653 1659 1654 1660 RenderBlock* cb = containingBlock(); … … 1661 1667 if (isInline() && !isInlineBlockOrInlineTable()) { 1662 1668 // 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)); 1665 1671 if (treatAsReplaced) 1666 1672 setLogicalWidth(max<LayoutUnit>(logicalWidthLength.calcFloatValue(0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth())); … … 1676 1682 1677 1683 // Calculate MaxLogicalWidth 1678 if (!style ()->logicalMaxWidth().isUndefined()) {1684 if (!styleToUse->logicalMaxWidth().isUndefined()) { 1679 1685 LayoutUnit maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection); 1680 1686 if (logicalWidth() > maxLogicalWidth) { 1681 1687 setLogicalWidth(maxLogicalWidth); 1682 logicalWidthLength = style ()->logicalMaxWidth();1688 logicalWidthLength = styleToUse->logicalMaxWidth(); 1683 1689 } 1684 1690 } … … 1688 1694 if (logicalWidth() < minLogicalWidth) { 1689 1695 setLogicalWidth(minLogicalWidth); 1690 logicalWidthLength = style ()->logicalMinWidth();1696 logicalWidthLength = styleToUse->logicalMinWidth(); 1691 1697 } 1692 1698 } … … 1700 1706 // Margin calculations. 1701 1707 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)); 1704 1710 } else 1705 1711 computeInlineDirectionMargins(cb, containerLogicalWidth, logicalWidth()); … … 1713 1719 { 1714 1720 LayoutUnit logicalWidthResult = logicalWidth(); 1721 RenderStyle* styleToUse = style(); 1715 1722 Length logicalWidth; 1716 1723 if (widthType == LogicalWidth) 1717 logicalWidth = style ()->logicalWidth();1724 logicalWidth = styleToUse->logicalWidth(); 1718 1725 else if (widthType == MinLogicalWidth) 1719 logicalWidth = style ()->logicalMinWidth();1726 logicalWidth = styleToUse->logicalMinWidth(); 1720 1727 else 1721 logicalWidth = style ()->logicalMaxWidth();1728 logicalWidth = styleToUse->logicalMaxWidth(); 1722 1729 1723 1730 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); 1726 1733 logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; 1727 1734 … … 1956 1963 // FIXME: Account for block-flow in flexible boxes. 1957 1964 // https://bugs.webkit.org/show_bug.cgi?id=46418 1965 RenderStyle* styleToUse = style(); 1958 1966 if (hasOverrideHeight() && parent()->isFlexibleBoxIncludingDeprecated()) 1959 1967 h = Length(overrideHeight() - borderAndPaddingLogicalHeight(), Fixed); … … 1961 1969 h = Length(computeReplacedLogicalHeight(), Fixed); 1962 1970 else { 1963 h = style ()->logicalHeight();1971 h = styleToUse->logicalHeight(); 1964 1972 checkMinMaxHeight = true; 1965 1973 } … … 1976 1984 LayoutUnit heightResult; 1977 1985 if (checkMinMaxHeight) { 1978 heightResult = computeLogicalHeightUsing(style ()->logicalHeight());1986 heightResult = computeLogicalHeightUsing(styleToUse->logicalHeight()); 1979 1987 // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148 1980 1988 if (heightResult == -1) 1981 1989 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()); 1984 1992 if (maxH == -1) 1985 1993 maxH = heightResult; … … 2064 2072 } 2065 2073 2074 RenderStyle* cbstyle = cb->style(); 2075 2066 2076 // A positioned element that specified both top/bottom or that specifies height should be treated as though it has a height 2067 2077 // explicitly specified that can be used for any percentage computations. 2068 2078 // FIXME: We can't just check top/bottom here. 2069 2079 // 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())); 2071 2081 2072 2082 bool includeBorderPadding = isTable(); … … 2096 2106 // Otherwise we only use our percentage height if our containing block had a specified 2097 2107 // 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) { 2101 2111 // 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()); 2103 2113 // FIXME: Use < 0 or roughlyEquals when we move to float, see https://bugs.webkit.org/show_bug.cgi?id=66148 2104 2114 if (result != -1) … … 2807 2817 2808 2818 bool isHorizontal = isHorizontalWritingMode(); 2809 bool isFlipped = style()->isFlippedBlocksWritingMode(); 2819 RenderStyle* styleToUse = style(); 2820 bool isFlipped = styleToUse->isFlippedBlocksWritingMode(); 2810 2821 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(); 2813 2824 LayoutUnit& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft); 2814 2825 LayoutUnit& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight); 2815 2826 2816 Length logicalTopLength = style ()->logicalTop();2817 Length logicalBottomLength = style ()->logicalBottom();2827 Length logicalTopLength = styleToUse->logicalTop(); 2828 Length logicalBottomLength = styleToUse->logicalBottom(); 2818 2829 2819 2830 /*---------------------------------------------------------------------------*\ … … 2842 2853 2843 2854 // Calculate constraint equation values for 'height' case. 2844 computePositionedLogicalHeightUsing(style ()->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,2855 computePositionedLogicalHeightUsing(styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2845 2856 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 2846 2857 logicalHeightResult, marginBeforeAlias, marginAfterAlias, logicalTopPos); … … 2851 2862 2852 2863 // Calculate constraint equation values for 'max-height' case. 2853 if (!style ()->logicalMaxHeight().isUndefined()) {2864 if (!styleToUse->logicalMaxHeight().isUndefined()) { 2854 2865 LayoutUnit maxLogicalHeight; 2855 2866 LayoutUnit maxMarginBefore; … … 2857 2868 LayoutUnit maxLogicalTopPos; 2858 2869 2859 computePositionedLogicalHeightUsing(style ()->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,2870 computePositionedLogicalHeightUsing(styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2860 2871 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 2861 2872 maxLogicalHeight, maxMarginBefore, maxMarginAfter, maxLogicalTopPos); … … 2870 2881 2871 2882 // Calculate constraint equation values for 'min-height' case. 2872 if (!style ()->logicalMinHeight().isZero()) {2883 if (!styleToUse->logicalMinHeight().isZero()) { 2873 2884 LayoutUnit minLogicalHeight; 2874 2885 LayoutUnit minMarginBefore; … … 2876 2887 LayoutUnit minLogicalTopPos; 2877 2888 2878 computePositionedLogicalHeightUsing(style ()->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,2889 computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2879 2890 logicalTopLength, logicalBottomLength, marginBefore, marginAfter, 2880 2891 minLogicalHeight, minMarginBefore, minMarginAfter, minLogicalTopPos); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r104851 r105394 312 312 // If our z-index changes value or our visibility changes, 313 313 // we need to dirty our stacking context's z-order list. 314 if (style() && newStyle) { 314 RenderStyle* oldStyle = style(); 315 if (oldStyle && newStyle) { 315 316 if (parent()) { 316 317 // Do a repaint with the old style first, e.g., for example if we go from … … 318 319 if (diff == StyleDifferenceRepaintLayer) { 319 320 layer()->repaintIncludingDescendants(); 320 if (!( style()->clip() == newStyle->clip()))321 if (!(oldStyle->clip() == newStyle->clip())) 321 322 layer()->clearClipRectsIncludingDescendants(); 322 } else if (diff == StyleDifferenceRepaint || newStyle->outlineSize() < style()->outlineSize())323 } else if (diff == StyleDifferenceRepaint || newStyle->outlineSize() < oldStyle->outlineSize()) 323 324 repaint(); 324 325 } … … 328 329 // end up being destroyed. 329 330 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()) 337 338 layer()->repaintIncludingDescendants(); 338 339 } else if (newStyle->hasTransform() || newStyle->opacity() < 1) { … … 343 344 } 344 345 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())) { 348 350 layer()->dirtyStackingContextZOrderLists(); 349 if ( style()->hasAutoZIndex() != newStyle->hasAutoZIndex() || style()->visibility() != newStyle->visibility())351 if (oldStyle->hasAutoZIndex() != newStyle->hasAutoZIndex() || oldStyle->visibility() != newStyle->visibility()) 350 352 layer()->dirtyZOrderLists(); 351 353 } … … 393 395 // Set the appropriate bits for a box model object. Since all bits are cleared in styleWillChange, 394 396 // 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()); 399 402 } 400 403 -
trunk/Source/WebCore/rendering/RenderInline.cpp
r104802 r105394 138 138 // and after the block share the same style, but the block doesn't 139 139 // need to pass its style on to anyone else. 140 RenderStyle* newStyle = style(); 140 141 for (RenderInline* currCont = inlineElementContinuation(); currCont; currCont = currCont->inlineElementContinuation()) { 141 142 RenderBoxModelObject* nextCont = currCont->continuation(); 142 143 currCont->setContinuation(0); 143 currCont->setStyle( style());144 currCont->setStyle(newStyle); 144 145 currCont->setContinuation(nextCont); 145 146 } … … 148 149 149 150 if (!m_alwaysCreateLineBoxes) { 150 bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || style()->hasPadding() || style()->hasMargin() || hasOutline();151 bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || newStyle->hasPadding() || newStyle->hasMargin() || hasOutline(); 151 152 if (oldStyle && alwaysCreateLineBoxes) { 152 153 dirtyLineBoxes(false); -
trunk/Source/WebCore/rendering/RenderText.cpp
r104552 r105394 190 190 } 191 191 192 RenderStyle* newStyle = style(); 192 193 bool needsResetText = false; 193 194 if (!oldStyle) { 194 195 updateNeedsTranscoding(); 195 196 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())) { 197 198 updateNeedsTranscoding(); 198 199 needsResetText = true; … … 201 202 ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE; 202 203 ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE; 203 if (needsResetText || oldTransform != style()->textTransform() || oldSecurity != style()->textSecurity()) {204 if (needsResetText || oldTransform != newStyle->textTransform() || oldSecurity != newStyle->textSecurity()) { 204 205 if (RefPtr<StringImpl> textToTransform = originalText()) 205 206 setText(textToTransform.release(), true); … … 906 907 m_hasEndWS = false; 907 908 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(); 910 912 int len = textLength(); 911 913 const UChar* txt = characters(); 912 LazyLineBreakIterator breakIterator(txt, len, style ()->locale());914 LazyLineBreakIterator breakIterator(txt, len, styleToUse->locale()); 913 915 bool needsWordSpacing = false; 914 916 bool ignoringSpaces = false; … … 921 923 // Non-zero only when kerning is enabled, in which case we measure words with their trailing 922 924 // 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; 924 926 925 927 int firstGlyphLeftOverflow = -1; 926 928 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(); 929 931 930 932 for (int i = 0; i < len; i++) { … … 935 937 bool isNewline = false; 936 938 if (c == '\n') { 937 if (style ()->preserveNewline()) {939 if (styleToUse->preserveNewline()) { 938 940 m_hasBreak = true; 939 941 isNewline = true; … … 942 944 isSpace = true; 943 945 } else if (c == '\t') { 944 if (!style ()->collapseWhiteSpace()) {946 if (!styleToUse->collapseWhiteSpace()) { 945 947 m_hasTab = true; 946 948 isSpace = false; … … 955 957 m_hasEndWS = true; 956 958 957 if (!ignoringSpaces && style ()->collapseWhiteSpace() && previousCharacterIsSpace && isSpace)959 if (!ignoringSpaces && styleToUse->collapseWhiteSpace() && previousCharacterIsSpace && isSpace) 958 960 ignoringSpaces = true; 959 961 … … 977 979 bool betweenWords = true; 978 980 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) { 980 982 j++; 981 983 if (j == len) … … 992 994 int wordLen = j - i; 993 995 if (wordLen) { 994 bool isSpace = (j < len) && isSpaceAccordingToStyle(c, style ());996 bool isSpace = (j < len) && isSpaceAccordingToStyle(c, styleToUse); 995 997 float w; 996 998 if (wordTrailingSpaceWidth && isSpace) … … 1010 1012 } 1011 1013 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()) 1014 1016 m_hasBreakableChar = true; 1015 1017 … … 1049 1051 firstLine = false; 1050 1052 leadWidth = 0; 1051 if (!style ()->autoWrap())1053 if (!styleToUse->autoWrap()) 1052 1054 m_beginMinWidth = currMaxWidth; 1053 1055 } … … 1057 1059 currMaxWidth = 0; 1058 1060 } else { 1059 TextRun run = RenderBlock::constructTextRun(this, f, txt + i, 1, style ());1061 TextRun run = RenderBlock::constructTextRun(this, f, txt + i, 1, styleToUse); 1060 1062 run.setCharactersLength(len - i); 1061 1063 ASSERT(run.charactersLength() >= run.length()); … … 1082 1084 m_maxWidth = max(currMaxWidth, m_maxWidth); 1083 1085 1084 if (!style ()->autoWrap())1086 if (!styleToUse->autoWrap()) 1085 1087 m_minWidth = m_maxWidth; 1086 1088 1087 if (style ()->whiteSpace() == PRE) {1089 if (styleToUse->whiteSpace() == PRE) { 1088 1090 if (firstLine) 1089 1091 m_beginMinWidth = m_maxWidth;
Note: See TracChangeset
for help on using the changeset viewer.