Commit c003d380 authored by pdr@chromium.org's avatar pdr@chromium.org

Revert "Cleanup deadcode in Rendering"

This reverts commit 25a48eab31ad4f0a54bcaea1ead2b0cc4dec74d2 [1]
with the exception of the changes in RenderFlowThread which have
additional changes on top of them and do not cleanly revert.

This is a speculative rollout, see crbug.com/402059.

[1] https://src.chromium.org/viewvc/blink?view=rev&revision=179521

BUG=402059
TBR=leviw
NOTRY=true

Review URL: https://codereview.chromium.org/463633002

git-svn-id: svn://svn.chromium.org/blink/trunk@179989 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7bd35a62
......@@ -177,6 +177,18 @@ bool HTMLSelectElement::valueMissing() const
return firstSelectionIndex < 0 || (!firstSelectionIndex && hasPlaceholderLabelOption());
}
void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
{
if (!multiple())
optionSelectedByUser(listToOptionIndex(listIndex), fireOnChangeNow, false);
else {
updateSelectedState(listIndex, allowMultiplySelections, shift);
setNeedsValidityCheck();
if (fireOnChangeNow)
listBoxOnChange();
}
}
bool HTMLSelectElement::usesMenuList() const
{
if (RenderTheme::theme().delegatesMenuListRendering())
......
......@@ -102,6 +102,8 @@ public:
void scrollToSelection();
void scrollTo(int listIndex);
void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true);
bool canSelectAll() const;
void selectAll();
int listToOptionIndex(int listIndex) const;
......
......@@ -4495,6 +4495,23 @@ LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
return logicalOffset + remainingLogicalHeight;
}
LayoutUnit RenderBlock::pageLogicalTopForOffset(LayoutUnit offset) const
{
RenderView* renderView = view();
LayoutUnit firstPageLogicalTop = isHorizontalWritingMode() ? renderView->layoutState()->pageOffset().height() : renderView->layoutState()->pageOffset().width();
LayoutUnit blockLogicalTop = isHorizontalWritingMode() ? renderView->layoutState()->layoutOffset().height() : renderView->layoutState()->layoutOffset().width();
LayoutUnit cumulativeOffset = offset + blockLogicalTop;
RenderFlowThread* flowThread = flowThreadContainingBlock();
if (!flowThread) {
LayoutUnit pageLogicalHeight = renderView->layoutState()->pageLogicalHeight();
if (!pageLogicalHeight)
return 0;
return cumulativeOffset - roundToInt(cumulativeOffset - firstPageLogicalTop) % roundToInt(pageLogicalHeight);
}
return flowThread->pageLogicalTopForOffset(cumulativeOffset);
}
LayoutUnit RenderBlock::pageLogicalHeightForOffset(LayoutUnit offset) const
{
RenderView* renderView = view();
......
......@@ -456,6 +456,7 @@ protected:
bool createsBlockFormattingContext() const;
public:
LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const;
LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule = IncludePageBoundary) const;
......
......@@ -53,6 +53,8 @@ public:
HTMLMapElement* imageMap() const;
void areaElementFocusChanged(HTMLAreaElement*);
void highQualityRepaintTimerFired(Timer<RenderImage>*);
void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = generated; }
bool isGeneratedContent() const { return m_isGeneratedContent; }
......
......@@ -1678,6 +1678,27 @@ int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine
return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
}
String RenderListMarker::suffix() const
{
EListStyleType type = style()->listStyleType();
const UChar suffix = listMarkerSuffix(type, m_listItem->value());
if (suffix == ' ')
return String(" ");
// If the suffix is not ' ', an extra space is needed
UChar data[2];
if (style()->isLeftToRightDirection()) {
data[0] = suffix;
data[1] = ' ';
} else {
data[0] = ' ';
data[1] = suffix;
}
return String(data, 2);
}
bool RenderListMarker::isInside() const
{
return m_listItem->notInList() || style()->listStylePosition() == INSIDE;
......
......@@ -41,6 +41,7 @@ public:
virtual void trace(Visitor*) OVERRIDE;
const String& text() const { return m_text; }
String suffix() const;
bool isInside() const;
......
......@@ -402,6 +402,11 @@ void RenderMenuList::valueChanged(unsigned listIndex, bool fireOnChange)
select->optionSelectedByUser(select->listToOptionIndex(listIndex), fireOnChange);
}
void RenderMenuList::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
{
selectElement()->listBoxSelectItem(listIndex, allowMultiplySelections, shift, fireOnChangeNow);
}
bool RenderMenuList::multiple() const
{
return selectElement()->multiple();
......
......@@ -95,6 +95,7 @@ private:
virtual bool itemIsLabel(unsigned listIndex) const OVERRIDE;
virtual bool itemIsSelected(unsigned listIndex) const OVERRIDE;
virtual void setTextFromItem(unsigned listIndex) OVERRIDE;
virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) OVERRIDE;
virtual bool multiple() const OVERRIDE;
virtual bool hasLineIfEmpty() const OVERRIDE { return true; }
......
......@@ -144,6 +144,18 @@ void RenderRegion::repaintFlowThreadContentRectangle(const LayoutRect& repaintRe
invalidatePaintRectangle(clippedRect);
}
LayoutUnit RenderRegion::logicalTopOfFlowThreadContentRect(const LayoutRect& rect) const
{
ASSERT(isValid());
return flowThread()->isHorizontalWritingMode() ? rect.y() : rect.x();
}
LayoutUnit RenderRegion::logicalBottomOfFlowThreadContentRect(const LayoutRect& rect) const
{
ASSERT(isValid());
return flowThread()->isHorizontalWritingMode() ? rect.maxY() : rect.maxX();
}
void RenderRegion::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
if (!isValid()) {
......
......@@ -64,6 +64,11 @@ public:
virtual LayoutUnit pageLogicalWidth() const;
virtual LayoutUnit pageLogicalHeight() const;
LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const;
LayoutUnit logicalBottomOfFlowThreadContentRect(const LayoutRect&) const;
LayoutUnit logicalTopForFlowThreadContent() const { return logicalTopOfFlowThreadContentRect(flowThreadPortionRect()); };
LayoutUnit logicalBottomForFlowThreadContent() const { return logicalBottomOfFlowThreadContentRect(flowThreadPortionRect()); };
virtual bool canHaveChildren() const OVERRIDE FINAL { return false; }
virtual bool canHaveGeneratedChildren() const OVERRIDE FINAL { return true; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment