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

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

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

Powered by Google App Engine
This is Rietveld 408576698