void RenderCounter::computePreferredLogicalWidths(float lead) { #ifndef NDEBUG // FIXME: We shouldn't be modifying the tree in computePreferredLogicalWidths. // Instead, we should properly hook the appropriate changes in the DOM and modify // the render tree then. When that's done, we also won't need to override // computePreferredLogicalWidths at all. // https://bugs.webkit.org/show_bug.cgi?id=104829 SetLayoutNeededForbiddenScope layoutForbiddenScope(this, false); #endif setTextInternal(originalText()); RenderText::computePreferredLogicalWidths(lead); }
void RenderMathMLRoot::computePreferredLogicalWidths() { ASSERT(preferredLogicalWidthsDirty() && needsLayout()); #ifndef NDEBUG // FIXME: Remove this once mathml stops modifying the render tree here. SetLayoutNeededForbiddenScope layoutForbiddenScope(this, false); #endif computeChildrenPreferredLogicalHeights(); int baseHeight = firstChild() ? roundToInt(preferredLogicalHeightAfterSizing(firstChild())) : style()->fontSize(); int frontWidth = lroundf(gFrontWidthEms * style()->fontSize()); // Base height above which the shape of the root changes float thresholdHeight = gThresholdBaseHeightEms * style()->fontSize(); if (baseHeight > thresholdHeight && thresholdHeight) { float shift = min<float>((baseHeight - thresholdHeight) / thresholdHeight, 1.0f); m_overbarLeftPointShift = static_cast<int>(shift * gRadicalBottomPointXFront * frontWidth); m_intrinsicPaddingAfter = lroundf(gBigRootBottomPaddingEms * style()->fontSize()); } else { m_overbarLeftPointShift = 0; m_intrinsicPaddingAfter = 0; } int rootPad = lroundf(gSpaceAboveEms * style()->fontSize()); m_intrinsicPaddingBefore = rootPad; m_indexTop = 0; if (RenderBoxModelObject* index = this->index()) { m_intrinsicPaddingStart = roundToInt(index->maxPreferredLogicalWidth()) + m_overbarLeftPointShift; int indexHeight = roundToInt(preferredLogicalHeightAfterSizing(index)); int partDipHeight = lroundf((1 - gRootRadicalDipLeftPointYPos) * baseHeight); int rootExtraTop = partDipHeight + indexHeight - (baseHeight + rootPad); if (rootExtraTop > 0) m_intrinsicPaddingBefore += rootExtraTop; else m_indexTop = - rootExtraTop; } else m_intrinsicPaddingStart = frontWidth; RenderMathMLBlock::computePreferredLogicalWidths(); // Shrink our logical width to its probable value now without triggering unnecessary relayout of our children. ASSERT(needsLayout() && logicalWidth() >= maxPreferredLogicalWidth()); setLogicalWidth(maxPreferredLogicalWidth()); }