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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Created 3 years, 11 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) 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 } 1036 }
1037 1037
1038 IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar( 1038 IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar(
1039 const IntRect& borderBoxRect) const { 1039 const IntRect& borderBoxRect) const {
1040 if (!hasHorizontalScrollbar()) 1040 if (!hasHorizontalScrollbar())
1041 return IntRect(); 1041 return IntRect();
1042 1042
1043 const IntRect& scrollCorner = scrollCornerRect(); 1043 const IntRect& scrollCorner = scrollCornerRect();
1044 1044
1045 return IntRect(horizontalScrollbarStart(borderBoxRect.x()), 1045 return IntRect(horizontalScrollbarStart(borderBoxRect.x()),
1046 borderBoxRect.maxY() - box().borderBottom() - 1046 borderBoxRect.maxY() - box().borderBottom().toInt() -
1047 horizontalScrollbar()->scrollbarThickness(), 1047 horizontalScrollbar()->scrollbarThickness(),
1048 borderBoxRect.width() - 1048 borderBoxRect.width() -
1049 (box().borderLeft() + box().borderRight()) - 1049 (box().borderLeft() + box().borderRight()).toInt() -
1050 scrollCorner.width(), 1050 scrollCorner.width(),
1051 horizontalScrollbar()->scrollbarThickness()); 1051 horizontalScrollbar()->scrollbarThickness());
1052 } 1052 }
1053 1053
1054 IntRect PaintLayerScrollableArea::rectForVerticalScrollbar( 1054 IntRect PaintLayerScrollableArea::rectForVerticalScrollbar(
1055 const IntRect& borderBoxRect) const { 1055 const IntRect& borderBoxRect) const {
1056 if (!hasVerticalScrollbar()) 1056 if (!hasVerticalScrollbar())
1057 return IntRect(); 1057 return IntRect();
1058 1058
1059 const IntRect& scrollCorner = scrollCornerRect(); 1059 const IntRect& scrollCorner = scrollCornerRect();
1060 1060
1061 return IntRect( 1061 return IntRect(
1062 verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()), 1062 verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()),
1063 borderBoxRect.y() + box().borderTop(), 1063 borderBoxRect.y() + box().borderTop().toInt(),
1064 verticalScrollbar()->scrollbarThickness(), 1064 verticalScrollbar()->scrollbarThickness(),
1065 borderBoxRect.height() - (box().borderTop() + box().borderBottom()) - 1065 borderBoxRect.height() -
1066 (box().borderTop() + box().borderBottom()).toInt() -
1066 scrollCorner.height()); 1067 scrollCorner.height());
1067 } 1068 }
1068 1069
1069 int PaintLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const { 1070 int PaintLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const {
1070 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 1071 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1071 return minX + box().borderLeft(); 1072 return minX + box().borderLeft().toInt();
1072 return maxX - box().borderRight() - verticalScrollbar()->scrollbarThickness(); 1073 return maxX - box().borderRight().toInt() -
1074 verticalScrollbar()->scrollbarThickness();
1073 } 1075 }
1074 1076
1075 int PaintLayerScrollableArea::horizontalScrollbarStart(int minX) const { 1077 int PaintLayerScrollableArea::horizontalScrollbarStart(int minX) const {
1076 int x = minX + box().borderLeft(); 1078 int x = minX + box().borderLeft().toInt();
1077 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 1079 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1078 x += hasVerticalScrollbar() 1080 x += hasVerticalScrollbar()
1079 ? verticalScrollbar()->scrollbarThickness() 1081 ? verticalScrollbar()->scrollbarThickness()
1080 : resizerCornerRect(box().pixelSnappedBorderBoxRect(), 1082 : resizerCornerRect(box().pixelSnappedBorderBoxRect(),
1081 ResizerForPointer) 1083 ResizerForPointer)
1082 .width(); 1084 .width();
1083 return x; 1085 return x;
1084 } 1086 }
1085 1087
1086 IntSize PaintLayerScrollableArea::scrollbarOffset( 1088 IntSize PaintLayerScrollableArea::scrollbarOffset(
1087 const Scrollbar& scrollbar) const { 1089 const Scrollbar& scrollbar) const {
1088 if (&scrollbar == verticalScrollbar()) 1090 if (&scrollbar == verticalScrollbar()) {
1089 return IntSize(verticalScrollbarStart(0, box().size().width().toInt()), 1091 return IntSize(verticalScrollbarStart(0, box().size().width().toInt()),
1090 box().borderTop()); 1092 box().borderTop().toInt());
1093 }
1091 1094
1092 if (&scrollbar == horizontalScrollbar()) 1095 if (&scrollbar == horizontalScrollbar())
1093 return IntSize( 1096 return IntSize(
1094 horizontalScrollbarStart(0), 1097 horizontalScrollbarStart(0),
1095 (box().size().height() - box().borderBottom() - scrollbar.height()) 1098 (box().size().height() - box().borderBottom() - scrollbar.height())
1096 .toInt()); 1099 .toInt());
1097 1100
1098 ASSERT_NOT_REACHED(); 1101 ASSERT_NOT_REACHED();
1099 return IntSize(); 1102 return IntSize();
1100 } 1103 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 resizeControlRect = 1361 resizeControlRect =
1359 resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer); 1362 resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer);
1360 if (resizeControlRect.contains(localPoint)) 1363 if (resizeControlRect.contains(localPoint))
1361 return true; 1364 return true;
1362 } 1365 }
1363 1366
1364 int resizeControlSize = max(resizeControlRect.height(), 0); 1367 int resizeControlSize = max(resizeControlRect.height(), 0);
1365 if (hasVerticalScrollbar() && 1368 if (hasVerticalScrollbar() &&
1366 verticalScrollbar()->shouldParticipateInHitTesting()) { 1369 verticalScrollbar()->shouldParticipateInHitTesting()) {
1367 LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width().toInt()), 1370 LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width().toInt()),
1368 box().borderTop(), 1371 box().borderTop().toInt(),
1369 verticalScrollbar()->scrollbarThickness(), 1372 verticalScrollbar()->scrollbarThickness(),
1370 box().size().height().toInt() - 1373 box().size().height().toInt() -
1371 (box().borderTop() + box().borderBottom()) - 1374 (box().borderTop() + box().borderBottom()).toInt() -
1372 (hasHorizontalScrollbar() 1375 (hasHorizontalScrollbar()
1373 ? horizontalScrollbar()->scrollbarThickness() 1376 ? horizontalScrollbar()->scrollbarThickness()
1374 : resizeControlSize)); 1377 : resizeControlSize));
1375 if (vBarRect.contains(localPoint)) { 1378 if (vBarRect.contains(localPoint)) {
1376 result.setScrollbar(verticalScrollbar()); 1379 result.setScrollbar(verticalScrollbar());
1377 return true; 1380 return true;
1378 } 1381 }
1379 } 1382 }
1380 1383
1381 resizeControlSize = max(resizeControlRect.width(), 0); 1384 resizeControlSize = max(resizeControlRect.width(), 0);
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 2102
2100 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: 2103 void PaintLayerScrollableArea::DelayScrollOffsetClampScope::
2101 clampScrollableAreas() { 2104 clampScrollableAreas() {
2102 for (auto& scrollableArea : *s_needsClamp) 2105 for (auto& scrollableArea : *s_needsClamp)
2103 scrollableArea->clampScrollOffsetAfterOverflowChange(); 2106 scrollableArea->clampScrollOffsetAfterOverflowChange();
2104 delete s_needsClamp; 2107 delete s_needsClamp;
2105 s_needsClamp = nullptr; 2108 s_needsClamp = nullptr;
2106 } 2109 }
2107 2110
2108 } // namespace blink 2111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698