summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-04-18 20:15:33 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-04-18 20:15:33 +0200
commit101c42443ea071d0ff8b1e2b9f9c6165165f0872 (patch)
tree3f0ee264ae10a8fe86ef3f56710f66b810fa89dc
parentc2bedab572e60d934b68650abbdca8fe9677c946 (diff)
downloaduxp-101c42443ea071d0ff8b1e2b9f9c6165165f0872.tar.gz
Use natural border width rounding.
Round subpixel border widths to nearest integer instead of nearest-below integer. Split caret widths off from border widths and continue to use rounding to nearest-below integer for that. Bump Goanna version for visual rendering change.
-rw-r--r--config/milestone.txt2
-rw-r--r--layout/base/nsCaret.cpp4
-rw-r--r--layout/style/nsStyleStruct.h11
3 files changed, 10 insertions, 7 deletions
diff --git a/config/milestone.txt b/config/milestone.txt
index 27f2d007f6..b617f64b75 100644
--- a/config/milestone.txt
+++ b/config/milestone.txt
@@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
-4.1.1
+4.1.2
diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp
index 2f08d156e6..8ad4359501 100644
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -200,8 +200,8 @@ nsCaret::ComputeMetrics(nsIFrame* aFrame, int32_t aOffset, nscoord aCaretHeight)
// between 0 and 1 goes up to 1 so we don't let the caret disappear.
int32_t tpp = aFrame->PresContext()->AppUnitsPerDevPixel();
Metrics result;
- result.mCaretWidth = NS_ROUND_BORDER_TO_PIXELS(caretWidth, tpp);
- result.mBidiIndicatorSize = NS_ROUND_BORDER_TO_PIXELS(bidiIndicatorSize, tpp);
+ result.mCaretWidth = NS_ROUND_CARET_TO_PIXELS(caretWidth, tpp);
+ result.mBidiIndicatorSize = NS_ROUND_CARET_TO_PIXELS(bidiIndicatorSize, tpp);
return result;
}
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index ca5d030566..05a6be91e2 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1197,11 +1197,14 @@ private:
nsCSSShadowItem mArray[1]; // This MUST be the last item
};
-// Border widths are rounded to the nearest-below integer number of pixels,
-// but values between zero and one device pixels are always rounded up to
-// one device pixel.
+// Border widths are rounded to the nearest integer number of pixels, but values
+// between zero and one device pixels are always rounded up to one device pixel.
#define NS_ROUND_BORDER_TO_PIXELS(l,tpp) \
- ((l) == 0) ? 0 : std::max((tpp), (l) / (tpp) * (tpp))
+ ((l) == 0) ? 0 : std::max((tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp))
+// Caret widths are rounded to the nearest-below integer number of pixels, but values
+// between zero and one device pixels are always rounded up to one device pixel.
+#define NS_ROUND_CARET_TO_PIXELS(l,tpp) \
+ ((l) == 0) ? 0 : std::max((tpp), (l) / (tpp) * (tpp))
// Outline offset is rounded to the nearest integer number of pixels, but values
// between zero and one device pixels are always rounded up to one device pixel.
// Note that the offset can be negative.