1
# Description: Revert "Cleanup deadcode in Rendering"
2
# https://chromium.googlesource.com/chromium/blink/+/25a48eab31ad4f0a54bcaea1ead2b0cc4dec74d2
3
# This breaks popup menus in Oxide
4
# Author: Chris Coulson <chris.coulson@canonical.com>
6
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
7
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
8
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
9
@@ -172,16 +172,28 @@ bool HTMLSelectElement::valueMissing() c
12
int firstSelectionIndex = selectedIndex();
14
// If a non-placeholer label option is selected (firstSelectionIndex > 0), it's not value-missing.
15
return firstSelectionIndex < 0 || (!firstSelectionIndex && hasPlaceholderLabelOption());
18
+void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
21
+ optionSelectedByUser(listToOptionIndex(listIndex), fireOnChangeNow, false);
23
+ updateSelectedState(listIndex, allowMultiplySelections, shift);
24
+ setNeedsValidityCheck();
25
+ if (fireOnChangeNow)
30
bool HTMLSelectElement::usesMenuList() const
32
if (RenderTheme::theme().delegatesMenuListRendering())
35
return !m_multiple && m_size <= 1;
38
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.h b/third_party/WebKit/Source/core/html/HTMLSelectElement.h
39
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.h
40
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.h
41
@@ -97,16 +97,18 @@ public:
42
void setLength(unsigned, ExceptionState&);
44
Element* namedItem(const AtomicString& name);
45
Element* item(unsigned index);
47
void scrollToSelection();
48
void scrollTo(int listIndex);
50
+ void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true);
52
bool canSelectAll() const;
54
int listToOptionIndex(int listIndex) const;
55
void listBoxOnChange();
56
int optionToListIndex(int optionIndex) const;
57
int activeSelectionStartListIndex() const;
58
int activeSelectionEndListIndex() const;
59
void setActiveSelectionAnchorIndex(int);
60
diff --git a/third_party/WebKit/Source/core/rendering/RenderBlock.cpp b/third_party/WebKit/Source/core/rendering/RenderBlock.cpp
61
--- a/third_party/WebKit/Source/core/rendering/RenderBlock.cpp
62
+++ b/third_party/WebKit/Source/core/rendering/RenderBlock.cpp
63
@@ -4490,16 +4490,33 @@ LayoutUnit RenderBlock::nextPageLogicalT
65
// The logicalOffset is in our coordinate space. We can add in our pushed offset.
66
LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logicalOffset);
67
if (pageBoundaryRule == ExcludePageBoundary)
68
return logicalOffset + (remainingLogicalHeight ? remainingLogicalHeight : pageLogicalHeight);
69
return logicalOffset + remainingLogicalHeight;
72
+LayoutUnit RenderBlock::pageLogicalTopForOffset(LayoutUnit offset) const
74
+ RenderView* renderView = view();
75
+ LayoutUnit firstPageLogicalTop = isHorizontalWritingMode() ? renderView->layoutState()->pageOffset().height() : renderView->layoutState()->pageOffset().width();
76
+ LayoutUnit blockLogicalTop = isHorizontalWritingMode() ? renderView->layoutState()->layoutOffset().height() : renderView->layoutState()->layoutOffset().width();
78
+ LayoutUnit cumulativeOffset = offset + blockLogicalTop;
79
+ RenderFlowThread* flowThread = flowThreadContainingBlock();
81
+ LayoutUnit pageLogicalHeight = renderView->layoutState()->pageLogicalHeight();
82
+ if (!pageLogicalHeight)
84
+ return cumulativeOffset - roundToInt(cumulativeOffset - firstPageLogicalTop) % roundToInt(pageLogicalHeight);
86
+ return flowThread->pageLogicalTopForOffset(cumulativeOffset);
89
LayoutUnit RenderBlock::pageLogicalHeightForOffset(LayoutUnit offset) const
91
RenderView* renderView = view();
92
RenderFlowThread* flowThread = flowThreadContainingBlock();
94
return renderView->layoutState()->pageLogicalHeight();
95
return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopOfFirstPage());
97
diff --git a/third_party/WebKit/Source/core/rendering/RenderBlock.h b/third_party/WebKit/Source/core/rendering/RenderBlock.h
98
--- a/third_party/WebKit/Source/core/rendering/RenderBlock.h
99
+++ b/third_party/WebKit/Source/core/rendering/RenderBlock.h
100
@@ -451,16 +451,17 @@ protected:
102
// For a page height of 800px, the first rule will return 800 if the value passed in is 0. The second rule will simply return 0.
103
enum PageBoundaryRule { ExcludePageBoundary, IncludePageBoundary };
104
LayoutUnit nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBoundary) const;
106
bool createsBlockFormattingContext() const;
109
+ LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
110
LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const;
111
LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule = IncludePageBoundary) const;
114
// A page break is required at some offset due to space shortage in the current fragmentainer.
115
void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage);
117
// Update minimum page height required to avoid fragmentation where it shouldn't occur (inside
118
diff --git a/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp b/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp
119
--- a/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp
120
+++ b/third_party/WebKit/Source/core/rendering/RenderFlowThread.cpp
121
@@ -170,16 +170,22 @@ void RenderFlowThread::repaintRectangleI
123
for (RenderMultiColumnSetList::const_iterator iter = m_multiColumnSetList.begin(); iter != m_multiColumnSetList.end(); ++iter) {
124
RenderMultiColumnSet* columnSet = *iter;
126
columnSet->repaintFlowThreadContent(repaintRect);
130
+LayoutUnit RenderFlowThread::pageLogicalTopForOffset(LayoutUnit offset)
132
+ RenderMultiColumnSet* columnSet = columnSetAtBlockOffset(offset);
133
+ return columnSet ? columnSet->pageLogicalTopForOffset(offset) : LayoutUnit();
136
LayoutUnit RenderFlowThread::pageLogicalHeightForOffset(LayoutUnit offset)
138
RenderMultiColumnSet* columnSet = columnSetAtBlockOffset(offset);
142
return columnSet->pageLogicalHeight();
144
diff --git a/third_party/WebKit/Source/core/rendering/RenderFlowThread.h b/third_party/WebKit/Source/core/rendering/RenderFlowThread.h
145
--- a/third_party/WebKit/Source/core/rendering/RenderFlowThread.h
146
+++ b/third_party/WebKit/Source/core/rendering/RenderFlowThread.h
147
@@ -77,16 +77,17 @@ public:
148
bool hasRegions() const { return m_multiColumnSetList.size(); }
150
void validateRegions();
151
void invalidateRegions();
152
bool hasValidRegionInfo() const { return !m_regionsInvalidated && !m_multiColumnSetList.isEmpty(); }
154
void repaintRectangleInRegions(const LayoutRect&) const;
156
+ LayoutUnit pageLogicalTopForOffset(LayoutUnit);
157
LayoutUnit pageLogicalHeightForOffset(LayoutUnit);
158
LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule = IncludePageBoundary);
160
virtual void setPageBreak(LayoutUnit /*offset*/, LayoutUnit /*spaceShortage*/) { }
161
virtual void updateMinimumPageHeight(LayoutUnit /*offset*/, LayoutUnit /*minHeight*/) { }
163
bool regionsHaveUniformLogicalHeight() const { return m_regionsHaveUniformLogicalHeight; }
165
diff --git a/third_party/WebKit/Source/core/rendering/RenderImage.h b/third_party/WebKit/Source/core/rendering/RenderImage.h
166
--- a/third_party/WebKit/Source/core/rendering/RenderImage.h
167
+++ b/third_party/WebKit/Source/core/rendering/RenderImage.h
168
@@ -48,16 +48,18 @@ public:
170
bool setImageSizeForAltText(ImageResource* newImage = 0);
172
void updateAltText();
174
HTMLMapElement* imageMap() const;
175
void areaElementFocusChanged(HTMLAreaElement*);
177
+ void highQualityRepaintTimerFired(Timer<RenderImage>*);
179
void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = generated; }
181
bool isGeneratedContent() const { return m_isGeneratedContent; }
183
String altText() const { return m_altText; }
185
inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
186
float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
187
diff --git a/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp b/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp
188
--- a/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp
189
+++ b/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp
190
@@ -1673,16 +1673,37 @@ LayoutUnit RenderListMarker::lineHeight(
191
int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
193
ASSERT(linePositionMode == PositionOnContainingLine);
195
return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
196
return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
199
+String RenderListMarker::suffix() const
201
+ EListStyleType type = style()->listStyleType();
202
+ const UChar suffix = listMarkerSuffix(type, m_listItem->value());
205
+ return String(" ");
207
+ // If the suffix is not ' ', an extra space is needed
209
+ if (style()->isLeftToRightDirection()) {
217
+ return String(data, 2);
220
bool RenderListMarker::isInside() const
222
return m_listItem->notInList() || style()->listStylePosition() == INSIDE;
225
IntRect RenderListMarker::getRelativeMarkerRect()
228
diff --git a/third_party/WebKit/Source/core/rendering/RenderListMarker.h b/third_party/WebKit/Source/core/rendering/RenderListMarker.h
229
--- a/third_party/WebKit/Source/core/rendering/RenderListMarker.h
230
+++ b/third_party/WebKit/Source/core/rendering/RenderListMarker.h
231
@@ -36,16 +36,17 @@ String listMarkerText(EListStyleType, in
232
class RenderListMarker FINAL : public RenderBox {
234
static RenderListMarker* createAnonymous(RenderListItem*);
236
virtual ~RenderListMarker();
237
virtual void trace(Visitor*) OVERRIDE;
239
const String& text() const { return m_text; }
240
+ String suffix() const;
242
bool isInside() const;
244
void updateMarginsAndContent();
247
RenderListMarker(RenderListItem*);
249
diff --git a/third_party/WebKit/Source/core/rendering/RenderMenuList.cpp b/third_party/WebKit/Source/core/rendering/RenderMenuList.cpp
250
--- a/third_party/WebKit/Source/core/rendering/RenderMenuList.cpp
251
+++ b/third_party/WebKit/Source/core/rendering/RenderMenuList.cpp
252
@@ -397,16 +397,21 @@ void RenderMenuList::valueChanged(unsign
253
Document& doc = toElement(node())->document();
254
if (&doc != doc.frame()->document())
257
HTMLSelectElement* select = selectElement();
258
select->optionSelectedByUser(select->listToOptionIndex(listIndex), fireOnChange);
261
+void RenderMenuList::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
263
+ selectElement()->listBoxSelectItem(listIndex, allowMultiplySelections, shift, fireOnChangeNow);
266
bool RenderMenuList::multiple() const
268
return selectElement()->multiple();
271
void RenderMenuList::didSetSelectedIndex(int listIndex)
273
didUpdateActiveOption(selectElement()->listToOptionIndex(listIndex));
274
diff --git a/third_party/WebKit/Source/core/rendering/RenderMenuList.h b/third_party/WebKit/Source/core/rendering/RenderMenuList.h
275
--- a/third_party/WebKit/Source/core/rendering/RenderMenuList.h
276
+++ b/third_party/WebKit/Source/core/rendering/RenderMenuList.h
277
@@ -90,16 +90,17 @@ private:
278
virtual LayoutUnit clientPaddingRight() const OVERRIDE;
279
virtual int listSize() const OVERRIDE;
280
virtual int selectedIndex() const OVERRIDE;
281
virtual void popupDidHide() OVERRIDE;
282
virtual bool itemIsSeparator(unsigned listIndex) const OVERRIDE;
283
virtual bool itemIsLabel(unsigned listIndex) const OVERRIDE;
284
virtual bool itemIsSelected(unsigned listIndex) const OVERRIDE;
285
virtual void setTextFromItem(unsigned listIndex) OVERRIDE;
286
+ virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true) OVERRIDE;
287
virtual bool multiple() const OVERRIDE;
289
virtual bool hasLineIfEmpty() const OVERRIDE { return true; }
291
// Flexbox defines baselines differently than regular blocks.
292
// For backwards compatibility, menulists need to do the regular block behavior.
293
virtual int baselinePosition(FontBaseline baseline, bool firstLine, LineDirectionMode direction, LinePositionMode position) const OVERRIDE
295
diff --git a/third_party/WebKit/Source/core/rendering/RenderRegion.cpp b/third_party/WebKit/Source/core/rendering/RenderRegion.cpp
296
--- a/third_party/WebKit/Source/core/rendering/RenderRegion.cpp
297
+++ b/third_party/WebKit/Source/core/rendering/RenderRegion.cpp
298
@@ -139,16 +139,28 @@ void RenderRegion::repaintFlowThreadCont
300
// Now switch to the region's writing mode coordinate space and let it repaint itself.
301
flipForWritingMode(clippedRect);
303
// Issue the repaint.
304
invalidatePaintRectangle(clippedRect);
307
+LayoutUnit RenderRegion::logicalTopOfFlowThreadContentRect(const LayoutRect& rect) const
310
+ return flowThread()->isHorizontalWritingMode() ? rect.y() : rect.x();
313
+LayoutUnit RenderRegion::logicalBottomOfFlowThreadContentRect(const LayoutRect& rect) const
316
+ return flowThread()->isHorizontalWritingMode() ? rect.maxY() : rect.maxX();
319
void RenderRegion::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
322
RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth);
326
minLogicalWidth = m_flowThread->minPreferredLogicalWidth();
327
diff --git a/third_party/WebKit/Source/core/rendering/RenderRegion.h b/third_party/WebKit/Source/core/rendering/RenderRegion.h
328
--- a/third_party/WebKit/Source/core/rendering/RenderRegion.h
329
+++ b/third_party/WebKit/Source/core/rendering/RenderRegion.h
330
@@ -59,16 +59,21 @@ public:
331
bool isLastRegion() const;
333
// These methods represent the width and height of a "page" and for a RenderRegion they are just
334
// the content width and content height of a region. For RenderMultiColumnSets, however, they
335
// will be the width and height of a single column or page in the set.
336
virtual LayoutUnit pageLogicalWidth() const;
337
virtual LayoutUnit pageLogicalHeight() const;
339
+ LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const;
340
+ LayoutUnit logicalBottomOfFlowThreadContentRect(const LayoutRect&) const;
341
+ LayoutUnit logicalTopForFlowThreadContent() const { return logicalTopOfFlowThreadContentRect(flowThreadPortionRect()); };
342
+ LayoutUnit logicalBottomForFlowThreadContent() const { return logicalBottomOfFlowThreadContentRect(flowThreadPortionRect()); };
344
virtual bool canHaveChildren() const OVERRIDE FINAL { return false; }
345
virtual bool canHaveGeneratedChildren() const OVERRIDE FINAL { return true; }
347
virtual const char* renderName() const OVERRIDE { return "RenderRegion"; }
350
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE FINAL;