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

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

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … Created 4 years, 10 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 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 x += textIndentOffset / 2; 906 x += textIndentOffset / 2;
907 else 907 else
908 x -= textIndentOffset / 2; 908 x -= textIndentOffset / 2;
909 break; 909 break;
910 case AlignRight: 910 case AlignRight:
911 x = maxX - caretWidth(); 911 x = maxX - caretWidth();
912 if (!currentStyle.isLeftToRightDirection()) 912 if (!currentStyle.isLeftToRightDirection())
913 x -= textIndentOffset; 913 x -= textIndentOffset;
914 break; 914 break;
915 } 915 }
916 x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth(), 0)); 916 x = std::min(x, (maxX - caretWidth()).clampToZero());
917 917
918 LayoutUnit height = style()->fontMetrics().height(); 918 LayoutUnit height = LayoutUnit(style()->fontMetrics().height());
919 LayoutUnit verticalSpace = lineHeight(true, currentStyle.isHorizontalWriting Mode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height; 919 LayoutUnit verticalSpace = lineHeight(true, currentStyle.isHorizontalWriting Mode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height;
920 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); 920 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2);
921 return currentStyle.isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth( ), height) : LayoutRect(y, x, height, caretWidth()); 921 return currentStyle.isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth( ), height) : LayoutRect(y, x, height, caretWidth());
922 } 922 }
923 923
924 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const 924 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const
925 { 925 {
926 LayoutObject* o = container(); 926 LayoutObject* o = container();
927 if (!o) 927 if (!o)
928 return; 928 return;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 if (rootElementStyle->hasBackground()) 1059 if (rootElementStyle->hasBackground())
1060 return false; 1060 return false;
1061 1061
1062 if (node() != document().firstBodyElement()) 1062 if (node() != document().firstBodyElement())
1063 return false; 1063 return false;
1064 1064
1065 return true; 1065 return true;
1066 } 1066 }
1067 1067
1068 } // namespace blink 1068 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698