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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 624
625 class AbsoluteRectsGeneratorContext { 625 class AbsoluteRectsGeneratorContext {
626 public: 626 public:
627 AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, const LayoutPoint& acc umulatedOffset) 627 AbsoluteRectsGeneratorContext(Vector<IntRect>& rects, const LayoutPoint& acc umulatedOffset)
628 : m_rects(rects) 628 : m_rects(rects)
629 , m_accumulatedOffset(accumulatedOffset) { } 629 , m_accumulatedOffset(accumulatedOffset) { }
630 630
631 void operator()(const LayoutRect& rect) 631 void operator()(const LayoutRect& rect)
632 { 632 {
633 IntRect intRect = enclosingIntRect(rect); 633 IntRect intRect = enclosingIntRect(rect);
634 intRect.move(m_accumulatedOffset.x(), m_accumulatedOffset.y()); 634 intRect.move(m_accumulatedOffset.x().toInt(), m_accumulatedOffset.y().to Int());
635 m_rects.append(intRect); 635 m_rects.append(intRect);
636 } 636 }
637 private: 637 private:
638 Vector<IntRect>& m_rects; 638 Vector<IntRect>& m_rects;
639 const LayoutPoint& m_accumulatedOffset; 639 const LayoutPoint& m_accumulatedOffset;
640 }; 640 };
641 641
642 } // unnamed namespace 642 } // unnamed namespace
643 643
644 void LayoutInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accu mulatedOffset) const 644 void LayoutInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accu mulatedOffset) const
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 return LayoutUnit(s->computedLineHeight()); 1225 return LayoutUnit(s->computedLineHeight());
1226 } 1226 }
1227 1227
1228 return LayoutUnit(style()->computedLineHeight()); 1228 return LayoutUnit(style()->computedLineHeight());
1229 } 1229 }
1230 1230
1231 int LayoutInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 1231 int LayoutInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const
1232 { 1232 {
1233 ASSERT(linePositionMode == PositionOnContainingLine); 1233 ASSERT(linePositionMode == PositionOnContainingLine);
1234 const FontMetrics& fontMetrics = style(firstLine)->getFontMetrics(); 1234 const FontMetrics& fontMetrics = style(firstLine)->getFontMetrics();
1235 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1235 return (fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2).toInt();
1236 } 1236 }
1237 1237
1238 LayoutSize LayoutInline::offsetForInFlowPositionedInline(const LayoutBox& child) const 1238 LayoutSize LayoutInline::offsetForInFlowPositionedInline(const LayoutBox& child) const
1239 { 1239 {
1240 // FIXME: This function isn't right with mixed writing modes. 1240 // FIXME: This function isn't right with mixed writing modes.
1241 1241
1242 ASSERT(isInFlowPositioned()); 1242 ASSERT(isInFlowPositioned());
1243 if (!isInFlowPositioned()) 1243 if (!isInFlowPositioned())
1244 return LayoutSize(); 1244 return LayoutSize();
1245 1245
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 1362
1363 void LayoutInline::invalidateDisplayItemClients(PaintInvalidationReason invalida tionReason) const 1363 void LayoutInline::invalidateDisplayItemClients(PaintInvalidationReason invalida tionReason) const
1364 { 1364 {
1365 LayoutBoxModelObject::invalidateDisplayItemClients(invalidationReason); 1365 LayoutBoxModelObject::invalidateDisplayItemClients(invalidationReason);
1366 1366
1367 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1367 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1368 invalidateDisplayItemClient(*box, invalidationReason); 1368 invalidateDisplayItemClient(*box, invalidationReason);
1369 } 1369 }
1370 1370
1371 } // namespace blink 1371 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFrameSet.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutListMarker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698