| OLD | NEW |
| 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 alignment = AlignRight; | 1169 alignment = AlignRight; |
| 1170 break; | 1170 break; |
| 1171 case ETextAlign::kEnd: | 1171 case ETextAlign::kEnd: |
| 1172 if (currentStyle.isLeftToRightDirection()) | 1172 if (currentStyle.isLeftToRightDirection()) |
| 1173 alignment = AlignRight; | 1173 alignment = AlignRight; |
| 1174 break; | 1174 break; |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 LayoutUnit x = borderLeft() + paddingLeft(); | 1177 LayoutUnit x = borderLeft() + paddingLeft(); |
| 1178 LayoutUnit maxX = width - borderRight() - paddingRight(); | 1178 LayoutUnit maxX = width - borderRight() - paddingRight(); |
| 1179 LayoutUnit caretWidth = frameView()->caretWidth(); |
| 1179 | 1180 |
| 1180 switch (alignment) { | 1181 switch (alignment) { |
| 1181 case AlignLeft: | 1182 case AlignLeft: |
| 1182 if (currentStyle.isLeftToRightDirection()) | 1183 if (currentStyle.isLeftToRightDirection()) |
| 1183 x += textIndentOffset; | 1184 x += textIndentOffset; |
| 1184 break; | 1185 break; |
| 1185 case AlignCenter: | 1186 case AlignCenter: |
| 1186 x = (x + maxX) / 2; | 1187 x = (x + maxX) / 2; |
| 1187 if (currentStyle.isLeftToRightDirection()) | 1188 if (currentStyle.isLeftToRightDirection()) |
| 1188 x += textIndentOffset / 2; | 1189 x += textIndentOffset / 2; |
| 1189 else | 1190 else |
| 1190 x -= textIndentOffset / 2; | 1191 x -= textIndentOffset / 2; |
| 1191 break; | 1192 break; |
| 1192 case AlignRight: | 1193 case AlignRight: |
| 1193 x = maxX - caretWidth(); | 1194 x = maxX - caretWidth; |
| 1194 if (!currentStyle.isLeftToRightDirection()) | 1195 if (!currentStyle.isLeftToRightDirection()) |
| 1195 x -= textIndentOffset; | 1196 x -= textIndentOffset; |
| 1196 break; | 1197 break; |
| 1197 } | 1198 } |
| 1198 x = std::min(x, (maxX - caretWidth()).clampNegativeToZero()); | 1199 x = std::min(x, (maxX - caretWidth).clampNegativeToZero()); |
| 1199 | 1200 |
| 1200 const Font& font = style()->font(); | 1201 const Font& font = style()->font(); |
| 1201 const SimpleFontData* fontData = font.primaryFont(); | 1202 const SimpleFontData* fontData = font.primaryFont(); |
| 1202 LayoutUnit height; | 1203 LayoutUnit height; |
| 1203 // crbug.com/595692 This check should not be needed but sometimes | 1204 // crbug.com/595692 This check should not be needed but sometimes |
| 1204 // primaryFont is null. | 1205 // primaryFont is null. |
| 1205 if (fontData) | 1206 if (fontData) |
| 1206 height = LayoutUnit(fontData->getFontMetrics().height()); | 1207 height = LayoutUnit(fontData->getFontMetrics().height()); |
| 1207 LayoutUnit verticalSpace = | 1208 LayoutUnit verticalSpace = |
| 1208 lineHeight(true, currentStyle.isHorizontalWritingMode() ? HorizontalLine | 1209 lineHeight(true, currentStyle.isHorizontalWritingMode() ? HorizontalLine |
| 1209 : VerticalLine, | 1210 : VerticalLine, |
| 1210 PositionOfInteriorLineBoxes) - | 1211 PositionOfInteriorLineBoxes) - |
| 1211 height; | 1212 height; |
| 1212 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); | 1213 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); |
| 1213 return currentStyle.isHorizontalWritingMode() | 1214 return currentStyle.isHorizontalWritingMode() |
| 1214 ? LayoutRect(x, y, caretWidth(), height) | 1215 ? LayoutRect(x, y, caretWidth, height) |
| 1215 : LayoutRect(y, x, height, caretWidth()); | 1216 : LayoutRect(y, x, height, caretWidth); |
| 1216 } | 1217 } |
| 1217 | 1218 |
| 1218 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer( | 1219 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer( |
| 1219 const LayoutBoxModelObject* ancestorToStopAt, | 1220 const LayoutBoxModelObject* ancestorToStopAt, |
| 1220 LayoutGeometryMap& geometryMap) const { | 1221 LayoutGeometryMap& geometryMap) const { |
| 1221 ASSERT(ancestorToStopAt != this); | 1222 ASSERT(ancestorToStopAt != this); |
| 1222 | 1223 |
| 1223 AncestorSkipInfo skipInfo(ancestorToStopAt); | 1224 AncestorSkipInfo skipInfo(ancestorToStopAt); |
| 1224 LayoutObject* container = this->container(&skipInfo); | 1225 LayoutObject* container = this->container(&skipInfo); |
| 1225 if (!container) | 1226 if (!container) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 if (rootElementStyle->hasBackground()) | 1360 if (rootElementStyle->hasBackground()) |
| 1360 return false; | 1361 return false; |
| 1361 | 1362 |
| 1362 if (node() != document().firstBodyElement()) | 1363 if (node() != document().firstBodyElement()) |
| 1363 return false; | 1364 return false; |
| 1364 | 1365 |
| 1365 return true; | 1366 return true; |
| 1366 } | 1367 } |
| 1367 | 1368 |
| 1368 } // namespace blink | 1369 } // namespace blink |
| OLD | NEW |