Changeset 158163 in webkit for trunk/Source/WebCore/rendering/RenderReplaced.cpp
- Timestamp:
- Oct 28, 2013, 7:58:43 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r158097 r158163 82 82 bool hadStyle = (oldStyle != 0); 83 83 float oldZoom = hadStyle ? oldStyle->effectiveZoom() : RenderStyle::initialZoom(); 84 if (style() && style()->effectiveZoom() != oldZoom)84 if (style().effectiveZoom() != oldZoom) 85 85 intrinsicSizeChanged(); 86 86 } … … 109 109 void RenderReplaced::intrinsicSizeChanged() 110 110 { 111 int scaledWidth = static_cast<int>(cDefaultWidth * style() ->effectiveZoom());112 int scaledHeight = static_cast<int>(cDefaultHeight * style() ->effectiveZoom());111 int scaledWidth = static_cast<int>(cDefaultWidth * style().effectiveZoom()); 112 int scaledHeight = static_cast<int>(cDefaultHeight * style().effectiveZoom()); 113 113 m_intrinsicSize = IntSize(scaledWidth, scaledHeight); 114 114 setNeedsLayoutAndPrefWidthsRecalc(); … … 131 131 132 132 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size()); 133 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style() ->outlineWidth())133 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style().outlineWidth()) 134 134 paintOutline(paintInfo, paintRect); 135 135 … … 148 148 149 149 bool completelyClippedOut = false; 150 if (style() ->hasBorderRadius()) {150 if (style().hasBorderRadius()) { 151 151 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); 152 152 … … 156 156 // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. 157 157 paintInfo.context->save(); 158 RoundedRect roundedInnerRect = style() ->getRoundedInnerBorderFor(paintRect,158 RoundedRect roundedInnerRect = style().getRoundedInnerBorderFor(paintRect, 159 159 paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true); 160 160 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect); … … 165 165 paintReplaced(paintInfo, adjustedPaintOffset); 166 166 167 if (style() ->hasBorderRadius())167 if (style().hasBorderRadius()) 168 168 paintInfo.context->restore(); 169 169 } … … 174 174 LayoutRect selectionPaintingRect = localSelectionRect(); 175 175 selectionPaintingRect.moveBy(adjustedPaintOffset); 176 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor(), style() ->colorSpace());176 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor(), style().colorSpace()); 177 177 } 178 178 } … … 188 188 189 189 // if we're invisible or haven't received a layout yet, then just bail. 190 if (style() ->visibility() != VISIBLE)190 if (style().visibility() != VISIBLE) 191 191 return false; 192 192 … … 225 225 226 226 for (; !containingBlock->isRenderView() && !containingBlock->isBody(); containingBlock = containingBlock->containingBlock()) { 227 if (containingBlock->style() ->logicalWidth().isSpecified())227 if (containingBlock->style().logicalWidth().isSpecified()) 228 228 return containingBlock; 229 229 } … … 234 234 bool RenderReplaced::hasReplacedLogicalWidth() const 235 235 { 236 if (style() ->logicalWidth().isSpecified())236 if (style().logicalWidth().isSpecified()) 237 237 return true; 238 238 239 if (style() ->logicalWidth().isAuto())239 if (style().logicalWidth().isAuto()) 240 240 return false; 241 241 … … 245 245 bool RenderReplaced::hasReplacedLogicalHeight() const 246 246 { 247 if (style() ->logicalHeight().isAuto())248 return false; 249 250 if (style() ->logicalHeight().isSpecified()) {247 if (style().logicalHeight().isAuto()) 248 return false; 249 250 if (style().logicalHeight().isSpecified()) { 251 251 if (hasAutoHeightOrContainingBlockWithAutoHeight()) 252 252 return false; … … 267 267 // Handle zoom & vertical writing modes here, as the embedded document doesn't know about them. 268 268 if (!isPercentageIntrinsicSize) 269 intrinsicSize.scale(style() ->effectiveZoom());269 intrinsicSize.scale(style().effectiveZoom()); 270 270 271 271 if (hasAspectRatio() && isPercentageIntrinsicSize) … … 299 299 // function was added, since all it has done is make the code more unclear. 300 300 constrainedSize = intrinsicSize; 301 if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty() && style() ->logicalWidth().isAuto() && style()->logicalHeight().isAuto()) {301 if (intrinsicRatio && !isPercentageIntrinsicSize && !intrinsicSize.isEmpty() && style().logicalWidth().isAuto() && style().logicalHeight().isAuto()) { 302 302 // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests, like fast/images/zoomed-img-size.html, which 303 303 // can only be fixed once subpixel precision is available for things like intrinsicWidth/Height - which include zoom! … … 310 310 { 311 311 LayoutRect contentRect = contentBoxRect(); 312 ObjectFit objectFit = style() ->objectFit();312 ObjectFit objectFit = style().objectFit(); 313 313 if (objectFit == ObjectFitFill) 314 314 return contentRect; … … 358 358 LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 359 359 { 360 if (style() ->logicalWidth().isSpecified() || style()->logicalWidth().isIntrinsic())361 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style() ->logicalWidth()), shouldComputePreferred);360 if (style().logicalWidth().isSpecified() || style().logicalWidth().isIntrinsic()) 361 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style().logicalWidth()), shouldComputePreferred); 362 362 363 363 RenderBox* contentRenderer = embeddedContentBox(); … … 369 369 computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio, isPercentageIntrinsicSize); 370 370 371 if (style() ->logicalWidth().isAuto()) {372 bool heightIsAuto = style() ->logicalHeight().isAuto();371 if (style().logicalWidth().isAuto()) { 372 bool heightIsAuto = style().logicalHeight().isAuto(); 373 373 bool hasIntrinsicWidth = !isPercentageIntrinsicSize && constrainedSize.width() > 0; 374 374 … … 395 395 LayoutUnit logicalWidth; 396 396 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) 397 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(blockWithWidth->style() ->logicalWidth()), shouldComputePreferred);397 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(blockWithWidth->style().logicalWidth()), shouldComputePreferred); 398 398 else 399 399 logicalWidth = containingBlock()->availableLogicalWidth(); 400 400 401 401 // This solves above equation for 'width' (== logicalWidth). 402 LayoutUnit marginStart = minimumValueForLength(style() ->marginStart(), logicalWidth);403 LayoutUnit marginEnd = minimumValueForLength(style() ->marginEnd(), logicalWidth);402 LayoutUnit marginStart = minimumValueForLength(style().marginStart(), logicalWidth); 403 LayoutUnit marginEnd = minimumValueForLength(style().marginEnd(), logicalWidth); 404 404 logicalWidth = max<LayoutUnit>(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth()))); 405 405 if (isPercentageIntrinsicSize) … … 427 427 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height 428 428 if (hasReplacedLogicalHeight()) 429 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style() ->logicalHeight()));429 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style().logicalHeight())); 430 430 431 431 RenderBox* contentRenderer = embeddedContentBox(); … … 437 437 computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio, isPercentageIntrinsicSize); 438 438 439 bool widthIsAuto = style() ->logicalWidth().isAuto();439 bool widthIsAuto = style().logicalWidth().isAuto(); 440 440 bool hasIntrinsicHeight = !isPercentageIntrinsicSize && constrainedSize.height() > 0; 441 441 … … 469 469 // We cannot resolve any percent logical width here as the available logical 470 470 // width may not be set on our containing block. 471 if (style() ->logicalWidth().isPercent())471 if (style().logicalWidth().isPercent()) 472 472 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 473 473 else 474 474 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(ComputePreferred); 475 475 476 RenderStyle*styleToUse = style();477 if (styleToUse ->logicalWidth().isPercent() || styleToUse->logicalMaxWidth().isPercent() || hasRelativeIntrinsicLogicalWidth())476 const RenderStyle& styleToUse = style(); 477 if (styleToUse.logicalWidth().isPercent() || styleToUse.logicalMaxWidth().isPercent() || hasRelativeIntrinsicLogicalWidth()) 478 478 m_minPreferredLogicalWidth = 0; 479 479 480 if (styleToUse ->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) {481 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse ->logicalMinWidth().value()));482 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse ->logicalMinWidth().value()));483 } 484 485 if (styleToUse ->logicalMaxWidth().isFixed()) {486 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse ->logicalMaxWidth().value()));487 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse ->logicalMaxWidth().value()));480 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().value() > 0) { 481 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 482 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 483 } 484 485 if (styleToUse.logicalMaxWidth().isFixed()) { 486 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 487 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 488 488 } 489 489 … … 548 548 549 549 const RootInlineBox& rootBox = m_inlineBoxWrapper->root(); 550 LayoutUnit newLogicalTop = rootBox.blockFlow().style() ->isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();551 if (rootBox.blockFlow().style() ->isHorizontalWritingMode())550 LayoutUnit newLogicalTop = rootBox.blockFlow().style().isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop(); 551 if (rootBox.blockFlow().style().isHorizontalWritingMode()) 552 552 return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight()); 553 553 return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height()); … … 588 588 LayoutRect RenderReplaced::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const 589 589 { 590 if (style() ->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent())590 if (style().visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent()) 591 591 return LayoutRect(); 592 592 … … 599 599 r.move(view().layoutDelta()); 600 600 601 if (style()) 602 r.inflate(style()->outlineSize()); 601 r.inflate(style().outlineSize()); 603 602 604 603 computeRectForRepaint(repaintContainer, r);
Note:
See TracChangeset
for help on using the changeset viewer.