Index: third_party/WebKit/Source/core/style/ComputedStyle.cpp |
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
index 09e6023e619cc06e2061952426da8199b9a32c10..aedf11027a24dc5cfa9a9215552689f78ead0496 100644 |
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
@@ -25,6 +25,7 @@ |
#include "core/animation/css/CSSAnimationData.h" |
#include "core/animation/css/CSSTransitionData.h" |
#include "core/css/CSSPaintValue.h" |
+#include "core/css/CSSPrimitiveValue.h" |
#include "core/css/CSSPropertyEquality.h" |
#include "core/css/resolver/StyleResolver.h" |
#include "core/layout/LayoutTheme.h" |
@@ -1862,4 +1863,20 @@ bool ComputedStyle::shadowListHasCurrentColor(const ShadowList* shadowList) |
return false; |
} |
+int adjustForAbsoluteZoom(int value, float zoomFactor) |
+{ |
+ if (zoomFactor == 1) |
+ return value; |
+ // Needed because computeLengthInt truncates (rather than rounds) when scaling up. |
+ float fvalue = value; |
+ if (zoomFactor > 1) { |
+ if (value < 0) |
+ fvalue -= 0.5f; |
+ else |
+ fvalue += 0.5f; |
+ } |
+ |
+ return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
+} |
+ |
} // namespace blink |