示例#1
0
void LayoutTextControl::computeLogicalHeight(
    LayoutUnit logicalHeight,
    LayoutUnit logicalTop,
    LogicalExtentComputedValues& computedValues) const {
    HTMLElement* innerEditor = innerEditorElement();
    ASSERT(innerEditor);
    if (LayoutBox* innerEditorBox = innerEditor->layoutBox()) {
        LayoutUnit nonContentHeight = innerEditorBox->borderAndPaddingHeight() +
                                      innerEditorBox->marginHeight();
        logicalHeight = computeControlLogicalHeight(
                            innerEditorBox->lineHeight(true, HorizontalLine,
                                    PositionOfInteriorLineBoxes),
                            nonContentHeight);

        // We are able to have a horizontal scrollbar if the overflow style is
        // scroll, or if its auto and there's no word wrap.
        if (style()->overflowInlineDirection() == OverflowScroll ||
                (style()->overflowInlineDirection() == OverflowAuto &&
                 innerEditor->layoutObject()->style()->overflowWrap() ==
                 NormalOverflowWrap))
            logicalHeight += scrollbarThickness();

        // FIXME: The logical height of the inner text box should have been added
        // before calling computeLogicalHeight to avoid this hack.
        setIntrinsicContentLogicalHeight(logicalHeight);

        logicalHeight += borderAndPaddingHeight();
    }

    LayoutBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
}
void RenderFrame::layout()
{
    FrameView* view = static_cast<FrameView*>(widget());
    RenderView* root = view ? view->frame()->contentRenderer() : 0;

    // Do not expand frames which has zero width or height
    if (!width() || !height() || !root) {
        updateWidgetPosition();
        if (view)
            view->layout();
        setNeedsLayout(false);
        return;
    }

    HTMLFrameElementBase* element = static_cast<HTMLFrameElementBase*>(node());
    if (element->scrollingMode() == ScrollbarAlwaysOff && !root->isFrameSet()) {
        setNeedsLayout(false);
        return;
    }

    // Update the dimensions to get the correct width and height
    updateWidgetPosition();
    if (root->preferredLogicalWidthsDirty())
        root->computePreferredLogicalWidths();

    // Expand the frame by setting frame height = content height
    setWidth(max(view->contentsWidth() + borderAndPaddingWidth(), width()));
    setHeight(max(view->contentsHeight() + borderAndPaddingHeight(), height()));

    // Update one more time
    updateWidgetPosition();

    setNeedsLayout(false);
}
示例#3
0
void LayoutMenuList::computeLogicalHeight(
    LayoutUnit logicalHeight,
    LayoutUnit logicalTop,
    LogicalExtentComputedValues& computedValues) const {
  if (style()->hasAppearance())
    logicalHeight = m_innerBlockHeight + borderAndPaddingHeight();
  LayoutBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
}
示例#4
0
void LayoutListBox::computeLogicalHeight(
    LayoutUnit,
    LayoutUnit logicalTop,
    LogicalExtentComputedValues& computedValues) const {
  LayoutUnit height = itemHeight() * size();
  // FIXME: The item height should have been added before updateLogicalHeight
  // was called to avoid this hack.
  setIntrinsicContentLogicalHeight(height);

  height += borderAndPaddingHeight();

  LayoutBox::computeLogicalHeight(height, logicalTop, computedValues);
}
void RenderSlider::layout()
{
    ASSERT(needsLayout());

    SliderThumbElement* thumbElement = shadowSliderThumb();
    RenderBox* thumb = thumbElement ? toRenderBox(thumbElement->renderer()) : 0;

    IntSize baseSize(borderAndPaddingWidth(), borderAndPaddingHeight());

    if (thumb) {
        // Allow the theme to set the size of the thumb.
        if (thumb->style()->hasAppearance()) {
            // FIXME: This should pass the style, not the renderer, to the theme.
            theme()->adjustSliderThumbSize(thumb);
        }

        baseSize.expand(thumb->style()->width().calcMinValue(0), thumb->style()->height().calcMinValue(0));
    }

    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());

    IntSize oldSize = size();

    setSize(baseSize);
    computeLogicalWidth();
    computeLogicalHeight();
    updateLayerTransform();

    if (thumb) {
        if (oldSize != size())
            thumb->setChildNeedsLayout(true, false);

        LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), style()->isFlippedBlocksWritingMode());

        IntRect oldThumbRect = thumb->frameRect();

        thumb->layoutIfNeeded();

        IntRect rect = thumbRect();
        thumb->setFrameRect(rect);
        if (thumb->checkForRepaintDuringLayout())
            thumb->repaintDuringLayoutIfMoved(oldThumbRect);

        statePusher.pop();
        addOverflowFromChild(thumb);
    }

    repainter.repaintAfterLayout();    

    setNeedsLayout(false);
}
示例#6
0
void RenderTextControl::computeLogicalHeight()
{
    HTMLElement* innerText = innerTextElement();
    ASSERT(innerText);
    RenderBox* innerTextRenderBox = innerText->renderBox();

    setHeight(innerTextRenderBox->borderTop() + innerTextRenderBox->borderBottom() +
              innerTextRenderBox->paddingTop() + innerTextRenderBox->paddingBottom() +
              innerTextRenderBox->marginTop() + innerTextRenderBox->marginBottom());

    adjustControlHeightBasedOnLineHeight(innerText->renderBox()->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes));
    setHeight(height() + borderAndPaddingHeight());

    // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
    if (style()->overflowX() == OSCROLL ||  (style()->overflowX() == OAUTO && innerText->renderer()->style()->wordWrap() == NormalWordWrap))
        setHeight(height() + scrollbarThickness());

    RenderBlock::computeLogicalHeight();
}
void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
    HTMLElement* innerEditor = innerEditorElement();
    ASSERT(innerEditor);
    if (RenderBox* innerEditorBox = innerEditor->renderBox()) {
        LayoutUnit nonContentHeight = innerEditorBox->borderAndPaddingHeight() + innerEditorBox->marginHeight();
        logicalHeight = computeControlLogicalHeight(innerEditorBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight);

        // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
        if ((isHorizontalWritingMode() && (style()->overflowX() == OSCROLL ||  (style()->overflowX() == OAUTO && innerEditor->renderer()->style()->overflowWrap() == NormalOverflowWrap)))
            || (!isHorizontalWritingMode() && (style()->overflowY() == OSCROLL ||  (style()->overflowY() == OAUTO && innerEditor->renderer()->style()->overflowWrap() == NormalOverflowWrap))))
            logicalHeight += scrollbarThickness();

        // FIXME: The logical height of the inner text box should have been added before calling computeLogicalHeight to
        // avoid this hack.
        updateIntrinsicContentLogicalHeight(logicalHeight);

        logicalHeight += borderAndPaddingHeight();
    }

    RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
}
示例#8
0
int RenderTextControl::textBlockHeight() const
{
    return height() - borderAndPaddingHeight();
}
示例#9
0
void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
    TextControlInnerTextElement* innerText = innerTextElement();
    ASSERT(innerText);
    if (RenderBox* innerTextBox = innerText->renderBox()) {
        LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
        logicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight();

        // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
        if ((isHorizontalWritingMode() && (style().overflowX() == OSCROLL ||  (style().overflowX() == OAUTO && innerText->renderer()->style().overflowWrap() == NormalOverflowWrap)))
            || (!isHorizontalWritingMode() && (style().overflowY() == OSCROLL ||  (style().overflowY() == OAUTO && innerText->renderer()->style().overflowWrap() == NormalOverflowWrap))))
            logicalHeight += scrollbarThickness();
    }

    RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
}