OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 } | 1041 } |
1042 | 1042 |
1043 IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar( | 1043 IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar( |
1044 const IntRect& borderBoxRect) const { | 1044 const IntRect& borderBoxRect) const { |
1045 if (!hasHorizontalScrollbar()) | 1045 if (!hasHorizontalScrollbar()) |
1046 return IntRect(); | 1046 return IntRect(); |
1047 | 1047 |
1048 const IntRect& scrollCorner = scrollCornerRect(); | 1048 const IntRect& scrollCorner = scrollCornerRect(); |
1049 | 1049 |
1050 return IntRect(horizontalScrollbarStart(borderBoxRect.x()), | 1050 return IntRect(horizontalScrollbarStart(borderBoxRect.x()), |
1051 borderBoxRect.maxY() - box().borderBottom() - | 1051 borderBoxRect.maxY() - box().borderBottom().toInt() - |
1052 horizontalScrollbar()->scrollbarThickness(), | 1052 horizontalScrollbar()->scrollbarThickness(), |
1053 borderBoxRect.width() - | 1053 borderBoxRect.width() - |
1054 (box().borderLeft() + box().borderRight()) - | 1054 (box().borderLeft() + box().borderRight()).toInt() - |
1055 scrollCorner.width(), | 1055 scrollCorner.width(), |
1056 horizontalScrollbar()->scrollbarThickness()); | 1056 horizontalScrollbar()->scrollbarThickness()); |
1057 } | 1057 } |
1058 | 1058 |
1059 IntRect PaintLayerScrollableArea::rectForVerticalScrollbar( | 1059 IntRect PaintLayerScrollableArea::rectForVerticalScrollbar( |
1060 const IntRect& borderBoxRect) const { | 1060 const IntRect& borderBoxRect) const { |
1061 if (!hasVerticalScrollbar()) | 1061 if (!hasVerticalScrollbar()) |
1062 return IntRect(); | 1062 return IntRect(); |
1063 | 1063 |
1064 const IntRect& scrollCorner = scrollCornerRect(); | 1064 const IntRect& scrollCorner = scrollCornerRect(); |
1065 | 1065 |
1066 return IntRect( | 1066 return IntRect( |
1067 verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()), | 1067 verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()), |
1068 borderBoxRect.y() + box().borderTop(), | 1068 borderBoxRect.y() + box().borderTop().toInt(), |
1069 verticalScrollbar()->scrollbarThickness(), | 1069 verticalScrollbar()->scrollbarThickness(), |
1070 borderBoxRect.height() - (box().borderTop() + box().borderBottom()) - | 1070 borderBoxRect.height() - |
| 1071 (box().borderTop() + box().borderBottom()).toInt() - |
1071 scrollCorner.height()); | 1072 scrollCorner.height()); |
1072 } | 1073 } |
1073 | 1074 |
1074 int PaintLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const { | 1075 int PaintLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const { |
1075 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1076 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
1076 return minX + box().borderLeft(); | 1077 return minX + box().borderLeft().toInt(); |
1077 return maxX - box().borderRight() - verticalScrollbar()->scrollbarThickness(); | 1078 return maxX - box().borderRight().toInt() - |
| 1079 verticalScrollbar()->scrollbarThickness(); |
1078 } | 1080 } |
1079 | 1081 |
1080 int PaintLayerScrollableArea::horizontalScrollbarStart(int minX) const { | 1082 int PaintLayerScrollableArea::horizontalScrollbarStart(int minX) const { |
1081 int x = minX + box().borderLeft(); | 1083 int x = minX + box().borderLeft().toInt(); |
1082 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1084 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
1083 x += hasVerticalScrollbar() | 1085 x += hasVerticalScrollbar() |
1084 ? verticalScrollbar()->scrollbarThickness() | 1086 ? verticalScrollbar()->scrollbarThickness() |
1085 : resizerCornerRect(box().pixelSnappedBorderBoxRect(), | 1087 : resizerCornerRect(box().pixelSnappedBorderBoxRect(), |
1086 ResizerForPointer) | 1088 ResizerForPointer) |
1087 .width(); | 1089 .width(); |
1088 return x; | 1090 return x; |
1089 } | 1091 } |
1090 | 1092 |
1091 IntSize PaintLayerScrollableArea::scrollbarOffset( | 1093 IntSize PaintLayerScrollableArea::scrollbarOffset( |
1092 const Scrollbar& scrollbar) const { | 1094 const Scrollbar& scrollbar) const { |
1093 if (&scrollbar == verticalScrollbar()) | 1095 if (&scrollbar == verticalScrollbar()) { |
1094 return IntSize(verticalScrollbarStart(0, box().size().width().toInt()), | 1096 return IntSize(verticalScrollbarStart(0, box().size().width().toInt()), |
1095 box().borderTop()); | 1097 box().borderTop().toInt()); |
| 1098 } |
1096 | 1099 |
1097 if (&scrollbar == horizontalScrollbar()) | 1100 if (&scrollbar == horizontalScrollbar()) |
1098 return IntSize( | 1101 return IntSize( |
1099 horizontalScrollbarStart(0), | 1102 horizontalScrollbarStart(0), |
1100 (box().size().height() - box().borderBottom() - scrollbar.height()) | 1103 (box().size().height() - box().borderBottom() - scrollbar.height()) |
1101 .toInt()); | 1104 .toInt()); |
1102 | 1105 |
1103 ASSERT_NOT_REACHED(); | 1106 ASSERT_NOT_REACHED(); |
1104 return IntSize(); | 1107 return IntSize(); |
1105 } | 1108 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 resizeControlRect = | 1364 resizeControlRect = |
1362 resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer); | 1365 resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer); |
1363 if (resizeControlRect.contains(localPoint)) | 1366 if (resizeControlRect.contains(localPoint)) |
1364 return true; | 1367 return true; |
1365 } | 1368 } |
1366 | 1369 |
1367 int resizeControlSize = max(resizeControlRect.height(), 0); | 1370 int resizeControlSize = max(resizeControlRect.height(), 0); |
1368 if (hasVerticalScrollbar() && | 1371 if (hasVerticalScrollbar() && |
1369 verticalScrollbar()->shouldParticipateInHitTesting()) { | 1372 verticalScrollbar()->shouldParticipateInHitTesting()) { |
1370 LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width().toInt()), | 1373 LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width().toInt()), |
1371 box().borderTop(), | 1374 box().borderTop().toInt(), |
1372 verticalScrollbar()->scrollbarThickness(), | 1375 verticalScrollbar()->scrollbarThickness(), |
1373 box().size().height().toInt() - | 1376 box().size().height().toInt() - |
1374 (box().borderTop() + box().borderBottom()) - | 1377 (box().borderTop() + box().borderBottom()).toInt() - |
1375 (hasHorizontalScrollbar() | 1378 (hasHorizontalScrollbar() |
1376 ? horizontalScrollbar()->scrollbarThickness() | 1379 ? horizontalScrollbar()->scrollbarThickness() |
1377 : resizeControlSize)); | 1380 : resizeControlSize)); |
1378 if (vBarRect.contains(localPoint)) { | 1381 if (vBarRect.contains(localPoint)) { |
1379 result.setScrollbar(verticalScrollbar()); | 1382 result.setScrollbar(verticalScrollbar()); |
1380 return true; | 1383 return true; |
1381 } | 1384 } |
1382 } | 1385 } |
1383 | 1386 |
1384 resizeControlSize = max(resizeControlRect.width(), 0); | 1387 resizeControlSize = max(resizeControlRect.width(), 0); |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 | 2120 |
2118 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2121 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2119 clampScrollableAreas() { | 2122 clampScrollableAreas() { |
2120 for (auto& scrollableArea : *s_needsClamp) | 2123 for (auto& scrollableArea : *s_needsClamp) |
2121 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2124 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
2122 delete s_needsClamp; | 2125 delete s_needsClamp; |
2123 s_needsClamp = nullptr; | 2126 s_needsClamp = nullptr; |
2124 } | 2127 } |
2125 | 2128 |
2126 } // namespace blink | 2129 } // namespace blink |
OLD | NEW |