Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: third_party/WebKit/Source/core/paint/ObjectPainter.cpp

Issue 1481483002: Fix crash in ObjectPainter::paintOutline in flipped blocks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebaseline Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/writing-mode/flipped-blocks-outline-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/ObjectPainter.h" 6 #include "core/paint/ObjectPainter.h"
7 7
8 #include "core/layout/LayoutBlock.h" 8 #include "core/layout/LayoutBlock.h"
9 #include "core/layout/LayoutInline.h" 9 #include "core/layout/LayoutInline.h"
10 #include "core/layout/LayoutObject.h" 10 #include "core/layout/LayoutObject.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (outlineRects.isEmpty()) 204 if (outlineRects.isEmpty())
205 return; 205 return;
206 206
207 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte xt, m_layoutObject, paintInfo.phase, paintOffset)) 207 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte xt, m_layoutObject, paintInfo.phase, paintOffset))
208 return; 208 return;
209 209
210 // The result rects are in coordinates of m_layoutObject's border box. 210 // The result rects are in coordinates of m_layoutObject's border box.
211 // Block flipping is not applied yet if !m_layoutObject.isBox(). 211 // Block flipping is not applied yet if !m_layoutObject.isBox().
212 if (!m_layoutObject.isBox() && m_layoutObject.styleRef().isFlippedBlocksWrit ingMode()) { 212 if (!m_layoutObject.isBox() && m_layoutObject.styleRef().isFlippedBlocksWrit ingMode()) {
213 LayoutBlock* container = m_layoutObject.containingBlock(); 213 LayoutBlock* container = m_layoutObject.containingBlock();
214 if (container) 214 if (container) {
215 m_layoutObject.localToContainerRects(outlineRects, container, -paint Offset, paintOffset); 215 m_layoutObject.localToContainerRects(outlineRects, container, -paint Offset, paintOffset);
216 if (outlineRects.isEmpty())
217 return;
218 }
216 } 219 }
217 220
218 Vector<IntRect> pixelSnappedOutlineRects; 221 Vector<IntRect> pixelSnappedOutlineRects;
219 for (auto& r : outlineRects) 222 for (auto& r : outlineRects)
220 pixelSnappedOutlineRects.append(pixelSnappedIntRect(r)); 223 pixelSnappedOutlineRects.append(pixelSnappedIntRect(r));
221 224
222 IntRect unitedOutlineRect = unionRectEvenIfEmpty(pixelSnappedOutlineRects); 225 IntRect unitedOutlineRect = unionRectEvenIfEmpty(pixelSnappedOutlineRects);
223 IntRect bounds = unitedOutlineRect; 226 IntRect bounds = unitedOutlineRect;
224 bounds.inflate(m_layoutObject.styleRef().outlineOutsetExtent()); 227 bounds.inflate(m_layoutObject.styleRef().outlineOutsetExtent());
225 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, pai ntInfo.phase, bounds, paintOffset); 228 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, pai ntInfo.phase, bounds, paintOffset);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); 529 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0));
527 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); 530 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0));
528 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); 531 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0));
529 break; 532 break;
530 } 533 }
531 534
532 graphicsContext->fillPolygon(4, quad, color, antialias); 535 graphicsContext->fillPolygon(4, quad, color, antialias);
533 } 536 }
534 537
535 } // namespace blink 538 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/writing-mode/flipped-blocks-outline-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698