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

Side by Side Diff: Source/core/paint/EllipsisBoxPainter.cpp

Issue 1316163002: Make the LayoutRect->FloatRect constructor explicit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months 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 | Annotate | Revision Log
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/EllipsisBoxPainter.h" 6 #include "core/paint/EllipsisBoxPainter.h"
7 7
8 #include "core/layout/TextRunConstructor.h" 8 #include "core/layout/TextRunConstructor.h"
9 #include "core/layout/api/SelectionState.h" 9 #include "core/layout/api/SelectionState.h"
10 #include "core/layout/line/EllipsisBox.h" 10 #include "core/layout/line/EllipsisBox.h"
(...skipping 19 matching lines...) Expand all
30 if (haveSelection) 30 if (haveSelection)
31 paintRect.unite(LayoutRect(m_ellipsisBox.selectionRect())); 31 paintRect.unite(LayoutRect(m_ellipsisBox.selectionRect()));
32 m_ellipsisBox.logicalRectToPhysicalRect(paintRect); 32 m_ellipsisBox.logicalRectToPhysicalRect(paintRect);
33 paintRect.moveBy(paintOffset); 33 paintRect.moveBy(paintOffset);
34 34
35 GraphicsContext* context = paintInfo.context; 35 GraphicsContext* context = paintInfo.context;
36 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai ntInfo.phase); 36 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai ntInfo.phase);
37 if (DrawingRecorder::useCachedDrawingIfPossible(*context, m_ellipsisBox, dis playItemType)) 37 if (DrawingRecorder::useCachedDrawingIfPossible(*context, m_ellipsisBox, dis playItemType))
38 return; 38 return;
39 39
40 DrawingRecorder recorder(*context, m_ellipsisBox, displayItemType, paintRect ); 40 DrawingRecorder recorder(*context, m_ellipsisBox, displayItemType, FloatRect (paintRect));
41 41
42 LayoutPoint boxOrigin = m_ellipsisBox.locationIncludingFlipping(); 42 LayoutPoint boxOrigin = m_ellipsisBox.locationIncludingFlipping();
43 boxOrigin.moveBy(paintOffset); 43 boxOrigin.moveBy(paintOffset);
44 LayoutRect boxRect(boxOrigin, LayoutSize(m_ellipsisBox.logicalWidth(), m_ell ipsisBox.virtualLogicalHeight())); 44 LayoutRect boxRect(boxOrigin, LayoutSize(m_ellipsisBox.logicalWidth(), m_ell ipsisBox.virtualLogicalHeight()));
45 45
46 GraphicsContextStateSaver stateSaver(*context); 46 GraphicsContextStateSaver stateSaver(*context);
47 if (!m_ellipsisBox.isHorizontal()) 47 if (!m_ellipsisBox.isHorizontal())
48 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise )); 48 context->concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise ));
49 49
50 const Font& font = style.font(); 50 const Font& font = style.font();
(...skipping 23 matching lines...) Expand all
74 // If the text color ends up being the same as the selection background, inv ert the selection 74 // If the text color ends up being the same as the selection background, inv ert the selection
75 // background. 75 // background.
76 if (textColor == c) 76 if (textColor == c)
77 c = Color(0xff - c.red(), 0xff - c.green(), 0xff - c.blue()); 77 c = Color(0xff - c.red(), 0xff - c.green(), 0xff - c.blue());
78 78
79 GraphicsContextStateSaver stateSaver(*context); 79 GraphicsContextStateSaver stateSaver(*context);
80 LayoutUnit selectionBottom = m_ellipsisBox.root().selectionBottom(); 80 LayoutUnit selectionBottom = m_ellipsisBox.root().selectionBottom();
81 LayoutUnit top = m_ellipsisBox.root().selectionTop(); 81 LayoutUnit top = m_ellipsisBox.root().selectionTop();
82 LayoutUnit h = m_ellipsisBox.root().selectionHeight(); 82 LayoutUnit h = m_ellipsisBox.root().selectionHeight();
83 const int deltaY = roundToInt(m_ellipsisBox.layoutObject().styleRef().isFlip pedLinesWritingMode() ? selectionBottom - m_ellipsisBox.logicalBottom() : m_elli psisBox.logicalTop() - top); 83 const int deltaY = roundToInt(m_ellipsisBox.layoutObject().styleRef().isFlip pedLinesWritingMode() ? selectionBottom - m_ellipsisBox.logicalBottom() : m_elli psisBox.logicalTop() - top);
84 const LayoutPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 84 const FloatPoint localOrigin(LayoutPoint(boxOrigin.x(), boxOrigin.y() - delt aY));
85 LayoutRect clipRect(localOrigin, LayoutSize(m_ellipsisBox.logicalWidth(), h) ); 85 FloatRect clipRect(localOrigin, FloatSize(LayoutSize(m_ellipsisBox.logicalWi dth(), h)));
86 context->clip(clipRect); 86 context->clip(clipRect);
87 context->drawHighlightForText(font, constructTextRun(font, m_ellipsisBox.ell ipsisStr(), style, TextRun::AllowTrailingExpansion), FloatPoint(localOrigin), h, c); 87 context->drawHighlightForText(font, constructTextRun(font, m_ellipsisBox.ell ipsisStr(), style, TextRun::AllowTrailingExpansion), localOrigin, h, c);
88 } 88 }
89 89
90 } // namespace blink 90 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp ('k') | Source/core/paint/EmbeddedObjectPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698