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

Unified Diff: Source/core/rendering/InlineTextBox.cpp

Issue 40733004: Replace compile flag with runtime check for text-underline-position (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed a typo in static function compileUnderlineOffset signature / Rebase Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/InlineTextBox.cpp
diff --git a/Source/core/rendering/InlineTextBox.cpp b/Source/core/rendering/InlineTextBox.cpp
index c5eff52094f0522dfb3d31262b97788995e9e592..3f615732900dff3448eeb6d08faf9dca38c0fb1e 100644
--- a/Source/core/rendering/InlineTextBox.cpp
+++ b/Source/core/rendering/InlineTextBox.cpp
@@ -916,8 +916,7 @@ static StrokeStyle textDecorationStyleToStrokeStyle(TextDecorationStyle decorati
return strokeStyle;
}
-#if ENABLE(CSS3_TEXT)
-static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition, const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const int textDecorationThickness)
+static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition, const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const float textDecorationThickness)
{
// Compute the gap between the font and the underline. Use at least one
// pixel gap, if underline is thick then use a bigger gap.
@@ -941,7 +940,6 @@ static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition,
ASSERT_NOT_REACHED();
return fontMetrics.ascent() + gap;
}
-#endif // CSS3_TEXT
static void adjustStepToDecorationLength(float& step, float& controlPointDistance, float length)
{
@@ -1140,13 +1138,7 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle));
if (deco & TextDecorationUnderline) {
context->setStrokeColor(underline);
-#if ENABLE(CSS3_TEXT)
- TextUnderlinePosition underlinePosition = styleToUse->textUnderlinePosition();
- const int underlineOffset = computeUnderlineOffset(underlinePosition, styleToUse->fontMetrics(), this, textDecorationThickness);
-#else
- const int underlineOffset = styleToUse->fontMetrics().ascent() + max<int>(1, ceilf(textDecorationThickness / 2.0));
-#endif // CSS3_TEXT
-
+ const int underlineOffset = computeUnderlineOffset(styleToUse->textUnderlinePosition(), styleToUse->fontMetrics(), this, textDecorationThickness);
switch (decorationStyle) {
case TextDecorationStyleWavy: {
FloatPoint start(localOrigin.x(), localOrigin.y() + underlineOffset + doubleOffset);

Powered by Google App Engine
This is Rietveld 408576698