~abreu-alexandre/oxide/add-ua-to-downloadrequested

« back to all changes in this revision

Viewing changes to patches/revert-blink-r179521.patch

  • Committer: Chris Coulson
  • Date: 2014-08-13 16:39:51 UTC
  • mfrom: (640.1.45 canary)
  • Revision ID: chris.coulson@canonical.com-20140813163951-6nt0we3lxlgnwfks
Bump Chromium rev to 38.0.2121.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
5
 
 
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
 
10
         return false;
 
11
 
 
12
     int firstSelectionIndex = selectedIndex();
 
13
 
 
14
     // If a non-placeholer label option is selected (firstSelectionIndex > 0), it's not value-missing.
 
15
     return firstSelectionIndex < 0 || (!firstSelectionIndex && hasPlaceholderLabelOption());
 
16
 }
 
17
 
 
18
+void HTMLSelectElement::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
 
19
+{
 
20
+    if (!multiple())
 
21
+        optionSelectedByUser(listToOptionIndex(listIndex), fireOnChangeNow, false);
 
22
+    else {
 
23
+        updateSelectedState(listIndex, allowMultiplySelections, shift);
 
24
+        setNeedsValidityCheck();
 
25
+        if (fireOnChangeNow)
 
26
+            listBoxOnChange();
 
27
+    }
 
28
+}
 
29
+
 
30
 bool HTMLSelectElement::usesMenuList() const
 
31
 {
 
32
     if (RenderTheme::theme().delegatesMenuListRendering())
 
33
         return true;
 
34
 
 
35
     return !m_multiple && m_size <= 1;
 
36
 }
 
37
 
 
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&);
 
43
 
 
44
     Element* namedItem(const AtomicString& name);
 
45
     Element* item(unsigned index);
 
46
 
 
47
     void scrollToSelection();
 
48
     void scrollTo(int listIndex);
 
49
 
 
50
+    void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true);
 
51
+
 
52
     bool canSelectAll() const;
 
53
     void selectAll();
 
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
 
64
 
 
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;
 
70
 }
 
71
 
 
72
+LayoutUnit RenderBlock::pageLogicalTopForOffset(LayoutUnit offset) const
 
73
+{
 
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();
 
77
+
 
78
+    LayoutUnit cumulativeOffset = offset + blockLogicalTop;
 
79
+    RenderFlowThread* flowThread = flowThreadContainingBlock();
 
80
+    if (!flowThread) {
 
81
+        LayoutUnit pageLogicalHeight = renderView->layoutState()->pageLogicalHeight();
 
82
+        if (!pageLogicalHeight)
 
83
+            return 0;
 
84
+        return cumulativeOffset - roundToInt(cumulativeOffset - firstPageLogicalTop) % roundToInt(pageLogicalHeight);
 
85
+    }
 
86
+    return flowThread->pageLogicalTopForOffset(cumulativeOffset);
 
87
+}
 
88
+
 
89
 LayoutUnit RenderBlock::pageLogicalHeightForOffset(LayoutUnit offset) const
 
90
 {
 
91
     RenderView* renderView = view();
 
92
     RenderFlowThread* flowThread = flowThreadContainingBlock();
 
93
     if (!flowThread)
 
94
         return renderView->layoutState()->pageLogicalHeight();
 
95
     return flowThread->pageLogicalHeightForOffset(offset + offsetFromLogicalTopOfFirstPage());
 
96
 }
 
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:
 
101
     //
 
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;
 
105
 
 
106
     bool createsBlockFormattingContext() const;
 
107
 
 
108
 public:
 
109
+    LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
 
110
     LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const;
 
111
     LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule = IncludePageBoundary) const;
 
112
 
 
113
 protected:
 
114
     // A page break is required at some offset due to space shortage in the current fragmentainer.
 
115
     void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage);
 
116
 
 
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
 
122
 
 
123
     for (RenderMultiColumnSetList::const_iterator iter = m_multiColumnSetList.begin(); iter != m_multiColumnSetList.end(); ++iter) {
 
124
         RenderMultiColumnSet* columnSet = *iter;
 
125
 
 
126
         columnSet->repaintFlowThreadContent(repaintRect);
 
127
     }
 
128
 }
 
129
 
 
130
+LayoutUnit RenderFlowThread::pageLogicalTopForOffset(LayoutUnit offset)
 
131
+{
 
132
+    RenderMultiColumnSet* columnSet = columnSetAtBlockOffset(offset);
 
133
+    return columnSet ? columnSet->pageLogicalTopForOffset(offset) : LayoutUnit();
 
134
+}
 
135
+
 
136
 LayoutUnit RenderFlowThread::pageLogicalHeightForOffset(LayoutUnit offset)
 
137
 {
 
138
     RenderMultiColumnSet* columnSet = columnSetAtBlockOffset(offset);
 
139
     if (!columnSet)
 
140
         return 0;
 
141
 
 
142
     return columnSet->pageLogicalHeight();
 
143
 }
 
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(); }
 
149
 
 
150
     void validateRegions();
 
151
     void invalidateRegions();
 
152
     bool hasValidRegionInfo() const { return !m_regionsInvalidated && !m_multiColumnSetList.isEmpty(); }
 
153
 
 
154
     void repaintRectangleInRegions(const LayoutRect&) const;
 
155
 
 
156
+    LayoutUnit pageLogicalTopForOffset(LayoutUnit);
 
157
     LayoutUnit pageLogicalHeightForOffset(LayoutUnit);
 
158
     LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule = IncludePageBoundary);
 
159
 
 
160
     virtual void setPageBreak(LayoutUnit /*offset*/, LayoutUnit /*spaceShortage*/) { }
 
161
     virtual void updateMinimumPageHeight(LayoutUnit /*offset*/, LayoutUnit /*minHeight*/) { }
 
162
 
 
163
     bool regionsHaveUniformLogicalHeight() const { return m_regionsHaveUniformLogicalHeight; }
 
164
 
 
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:
 
169
 
 
170
     bool setImageSizeForAltText(ImageResource* newImage = 0);
 
171
 
 
172
     void updateAltText();
 
173
 
 
174
     HTMLMapElement* imageMap() const;
 
175
     void areaElementFocusChanged(HTMLAreaElement*);
 
176
 
 
177
+    void highQualityRepaintTimerFired(Timer<RenderImage>*);
 
178
+
 
179
     void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = generated; }
 
180
 
 
181
     bool isGeneratedContent() const { return m_isGeneratedContent; }
 
182
 
 
183
     String altText() const { return m_altText; }
 
184
 
 
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
 
192
 {
 
193
     ASSERT(linePositionMode == PositionOnContainingLine);
 
194
     if (!isImage())
 
195
         return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
 
196
     return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
 
197
 }
 
198
 
 
199
+String RenderListMarker::suffix() const
 
200
+{
 
201
+    EListStyleType type = style()->listStyleType();
 
202
+    const UChar suffix = listMarkerSuffix(type, m_listItem->value());
 
203
+
 
204
+    if (suffix == ' ')
 
205
+        return String(" ");
 
206
+
 
207
+    // If the suffix is not ' ', an extra space is needed
 
208
+    UChar data[2];
 
209
+    if (style()->isLeftToRightDirection()) {
 
210
+        data[0] = suffix;
 
211
+        data[1] = ' ';
 
212
+    } else {
 
213
+        data[0] = ' ';
 
214
+        data[1] = suffix;
 
215
+    }
 
216
+
 
217
+    return String(data, 2);
 
218
+}
 
219
+
 
220
 bool RenderListMarker::isInside() const
 
221
 {
 
222
     return m_listItem->notInList() || style()->listStylePosition() == INSIDE;
 
223
 }
 
224
 
 
225
 IntRect RenderListMarker::getRelativeMarkerRect()
 
226
 {
 
227
     if (isImage())
 
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 {
 
233
 public:
 
234
     static RenderListMarker* createAnonymous(RenderListItem*);
 
235
 
 
236
     virtual ~RenderListMarker();
 
237
     virtual void trace(Visitor*) OVERRIDE;
 
238
 
 
239
     const String& text() const { return m_text; }
 
240
+    String suffix() const;
 
241
 
 
242
     bool isInside() const;
 
243
 
 
244
     void updateMarginsAndContent();
 
245
 
 
246
 private:
 
247
     RenderListMarker(RenderListItem*);
 
248
 
 
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())
 
255
         return;
 
256
 
 
257
     HTMLSelectElement* select = selectElement();
 
258
     select->optionSelectedByUser(select->listToOptionIndex(listIndex), fireOnChange);
 
259
 }
 
260
 
 
261
+void RenderMenuList::listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow)
 
262
+{
 
263
+    selectElement()->listBoxSelectItem(listIndex, allowMultiplySelections, shift, fireOnChangeNow);
 
264
+}
 
265
+
 
266
 bool RenderMenuList::multiple() const
 
267
 {
 
268
     return selectElement()->multiple();
 
269
 }
 
270
 
 
271
 void RenderMenuList::didSetSelectedIndex(int listIndex)
 
272
 {
 
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;
 
288
 
 
289
     virtual bool hasLineIfEmpty() const OVERRIDE { return true; }
 
290
 
 
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
 
294
     {
 
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
 
299
 
 
300
     // Now switch to the region's writing mode coordinate space and let it repaint itself.
 
301
     flipForWritingMode(clippedRect);
 
302
 
 
303
     // Issue the repaint.
 
304
     invalidatePaintRectangle(clippedRect);
 
305
 }
 
306
 
 
307
+LayoutUnit RenderRegion::logicalTopOfFlowThreadContentRect(const LayoutRect& rect) const
 
308
+{
 
309
+    ASSERT(isValid());
 
310
+    return flowThread()->isHorizontalWritingMode() ? rect.y() : rect.x();
 
311
+}
 
312
+
 
313
+LayoutUnit RenderRegion::logicalBottomOfFlowThreadContentRect(const LayoutRect& rect) const
 
314
+{
 
315
+    ASSERT(isValid());
 
316
+    return flowThread()->isHorizontalWritingMode() ? rect.maxY() : rect.maxX();
 
317
+}
 
318
+
 
319
 void RenderRegion::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 
320
 {
 
321
     if (!isValid()) {
 
322
         RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth);
 
323
         return;
 
324
     }
 
325
 
 
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;
 
332
 
 
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;
 
338
 
 
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()); };
 
343
+
 
344
     virtual bool canHaveChildren() const OVERRIDE FINAL { return false; }
 
345
     virtual bool canHaveGeneratedChildren() const OVERRIDE FINAL { return true; }
 
346
 
 
347
     virtual const char* renderName() const OVERRIDE { return "RenderRegion"; }
 
348
 
 
349
 protected:
 
350
     virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE FINAL;
 
351