int RenderTextControl::textBlockLogicalWidth() const { TextControlInnerTextElement* innerText = innerTextElement(); ASSERT(innerText); LayoutUnit unitWidth = logicalWidth() - borderAndPaddingLogicalWidth(); if (innerText->renderer()) unitWidth -= innerText->renderBox()->paddingStart() + innerText->renderBox()->paddingEnd(); return unitWidth; }
void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset) { TextControlInnerTextElement* innerText = innerTextElement(); if (!innerText->renderer()) return; LayoutPoint adjustedLocation = accumulatedOffset + location(); LayoutPoint localPoint = pointInContainer - toLayoutSize(adjustedLocation + innerText->renderBox()->location()) + scrolledContentOffset(); result.setInnerNode(innerText); result.setInnerNonSharedNode(innerText); result.setLocalPoint(localPoint); }
void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const { TextControlInnerTextElement* innerText = innerTextElement(); ASSERT(innerText); if (RenderBox* innerTextBox = innerText->renderBox()) { LayoutUnit nonContentHeight = innerTextBox->verticalBorderAndPaddingExtent() + innerTextBox->verticalMarginExtent(); logicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + verticalBorderAndPaddingExtent(); // 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); }
void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction) { if (!isTextFormControl()) return; end = std::max(end, 0); start = std::min(std::max(start, 0), end); TextControlInnerTextElement* innerText = innerTextElement(); bool hasFocus = document().focusedElement() == this; if (!hasFocus && innerText) { // FIXME: Removing this synchronous layout requires fixing <https://webkit.org/b/128797> document().updateLayoutIgnorePendingStylesheets(); if (RenderElement* rendererTextControl = renderer()) { if (rendererTextControl->style().visibility() == HIDDEN || !innerText->renderBox()->height()) { cacheSelection(start, end, direction); return; } } } Position startPosition = positionForIndex(innerText, start); Position endPosition; if (start == end) endPosition = startPosition; else { if (direction == SelectionHasBackwardDirection) { endPosition = startPosition; startPosition = positionForIndex(innerText, end); } else endPosition = positionForIndex(innerText, end); } if (Frame* frame = document().frame()) frame->selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus); }