Diff
Modified: trunk/Source/WebCore/ChangeLog (158293 => 158294)
--- trunk/Source/WebCore/ChangeLog 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/ChangeLog 2013-10-30 18:49:31 UTC (rev 158294)
@@ -1,3 +1,26 @@
+2013-10-30 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r158243.
+ http://trac.webkit.org/changeset/158243
+ https://bugs.webkit.org/show_bug.cgi?id=123520
+
+ Change was wrong (Requested by smfr on #webkit).
+
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/blackberry/PathBlackBerry.cpp:
+ (WebCore::GraphicsContext::drawLineForText):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::drawLineForText):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::drawLineForText):
+ * platform/graphics/wince/GraphicsContextWinCE.cpp:
+ (WebCore::GraphicsContext::drawLineForText):
+ * platform/win/WebCoreTextRenderer.cpp:
+ (WebCore::doDrawTextAtPoint):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paintDecoration):
+ (WebCore::InlineTextBox::paintCompositionUnderline):
+
2013-10-30 pe...@outlook.com <pe...@outlook.com>
Favicons are flipped in vertical direction in WinCairo builds.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (158293 => 158294)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2013-10-30 18:49:31 UTC (rev 158294)
@@ -330,7 +330,7 @@
};
FloatRect roundToDevicePixels(const FloatRect&, RoundingMode = RoundAllSides);
- void drawLineForText(const FloatRect& bounds, bool printing);
+ void drawLineForText(const FloatPoint&, float width, bool printing);
enum DocumentMarkerLineStyle {
DocumentMarkerSpellingLineStyle,
DocumentMarkerGrammarLineStyle,
Modified: trunk/Source/WebCore/platform/graphics/blackberry/PathBlackBerry.cpp (158293 => 158294)
--- trunk/Source/WebCore/platform/graphics/blackberry/PathBlackBerry.cpp 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/platform/graphics/blackberry/PathBlackBerry.cpp 2013-10-30 18:49:31 UTC (rev 158294)
@@ -263,12 +263,12 @@
platformContext()->addDrawLineForDocumentMarker(pt, width, (BlackBerry::Platform::Graphics::DocumentMarkerLineStyle)style);
}
-void GraphicsContext::drawLineForText(const FloatRect& bounds, bool printing)
+void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool printing)
{
if (paintingDisabled())
return;
- platformContext()->addDrawLineForText(bounds.location, bounds.width(), printing);
+ platformContext()->addDrawLineForText(pt, width, printing);
}
// FIXME: don't ignore the winding rule. https://bugs.webkit.org/show_bug.cgi?id=107064
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (158293 => 158294)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2013-10-30 18:49:31 UTC (rev 158294)
@@ -614,7 +614,7 @@
cairo_restore(cr);
}
-void GraphicsContext::drawLineForText(const FloatRect& bounds, bool)
+void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, bool)
{
if (paintingDisabled())
return;
@@ -623,16 +623,16 @@
cairo_save(cairoContext);
// This bumping of <1 stroke thicknesses matches the one in drawLineOnCairoContext.
- FloatPoint endPoint(bounds.location() + IntSize(bounds.width(), 0));
- FloatRect lineExtents(bounds.location(), FloatSize(bounds.width(), strokeThickness()));
+ FloatPoint endPoint(origin + IntSize(width, 0));
+ FloatRect lineExtents(origin, FloatSize(width, strokeThickness()));
ShadowBlur& shadow = platformContext()->shadowBlur();
if (GraphicsContext* shadowContext = shadow.beginShadowLayer(this, lineExtents)) {
- drawLineOnCairoContext(this, shadowContext->platformContext()->cr(), bounds.location(), endPoint);
+ drawLineOnCairoContext(this, shadowContext->platformContext()->cr(), origin, endPoint);
shadow.endShadowLayer(this);
}
- drawLineOnCairoContext(this, cairoContext, bounds.location(), endPoint);
+ drawLineOnCairoContext(this, cairoContext, origin, endPoint);
cairo_restore(cairoContext);
}
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (158293 => 158294)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-10-30 18:49:31 UTC (rev 158294)
@@ -1235,16 +1235,53 @@
return FloatRect(roundedOrigin, roundedLowerRight - roundedOrigin);
}
-void GraphicsContext::drawLineForText(const FloatRect& bounds, bool)
+void GraphicsContext::drawLineForText(const FloatPoint& point, float width, bool printing)
{
if (paintingDisabled())
return;
+ if (width <= 0)
+ return;
+
+ float x = point.x();
+ float y = point.y();
+ float lineLength = width;
+
+ // Use a minimum thickness of 0.5 in user space.
+ // See http://bugs.webkit.org/show_bug.cgi?id=4255 for details of why 0.5 is the right minimum thickness to use.
+ float thickness = max(strokeThickness(), 0.5f);
+
+ bool restoreAntialiasMode = false;
+
+ if (!printing && getCTM(GraphicsContext::DefinitelyIncludeDeviceScale).preservesAxisAlignment()) {
+ // On screen, use a minimum thickness of 1.0 in user space (later rounded to an integral number in device space).
+ float adjustedThickness = max(thickness, 1.0f);
+
+ // FIXME: This should be done a better way.
+ // We try to round all parameters to integer boundaries in device space. If rounding pixels in device space
+ // makes our thickness more than double, then there must be a shrinking-scale factor and rounding to pixels
+ // in device space will make the underlines too thick.
+ CGRect lineRect = roundToDevicePixels(FloatRect(x, y, lineLength, adjustedThickness), RoundAllSides);
+ if (lineRect.size.height < thickness * 2.0) {
+ x = lineRect.origin.x;
+ y = lineRect.origin.y;
+ lineLength = lineRect.size.width;
+ thickness = lineRect.size.height;
+ if (shouldAntialias()) {
+ CGContextSetShouldAntialias(platformContext(), false);
+ restoreAntialiasMode = true;
+ }
+ }
+ }
+
if (fillColor() != strokeColor())
setCGFillColor(platformContext(), strokeColor(), strokeColorSpace());
- CGContextFillRect(platformContext(), CGRectMake(bounds.location().x(), bounds.location().y(), bounds.width(), bounds.height()));
+ CGContextFillRect(platformContext(), CGRectMake(x, y, lineLength, thickness));
if (fillColor() != strokeColor())
setCGFillColor(platformContext(), fillColor(), fillColorSpace());
+
+ if (restoreAntialiasMode)
+ CGContextSetShouldAntialias(platformContext(), true);
}
void GraphicsContext::setURLForRect(const URL& link, const IntRect& destRect)
Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (158293 => 158294)
--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp 2013-10-30 18:49:31 UTC (rev 158294)
@@ -950,14 +950,14 @@
DrawFocusRect(dc, &rect);
}
-void GraphicsContext::drawLineForText(const FloatRect& bounds, bool)
+void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, bool printing)
{
if (paintingDisabled())
return;
StrokeStyle oldStyle = strokeStyle();
setStrokeStyle(SolidStroke);
- drawLine(roundedIntPoint(bounds.location()), roundedIntPoint(bounds.location() + FloatSize(bounds.width(), 0)));
+ drawLine(roundedIntPoint(origin), roundedIntPoint(origin + FloatSize(width, 0)));
setStrokeStyle(oldStyle);
}
Modified: trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp (158293 => 158294)
--- trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp 2013-10-30 18:49:31 UTC (rev 158294)
@@ -76,8 +76,7 @@
underlinePoint.move(beforeWidth, 1);
context.setStrokeColor(color, ColorSpaceDeviceRGB);
- FloatRect bounds(underlinePoint, FloatSize(underlinedWidth, context.strokeThickness()));
- context.drawLineForText(bounds, false);
+ context.drawLineForText(underlinePoint, underlinedWidth, false);
}
}
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (158293 => 158294)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-10-30 18:31:42 UTC (rev 158293)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-10-30 18:49:31 UTC (rev 158294)
@@ -67,49 +67,6 @@
typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap;
static InlineTextBoxOverflowMap* gTextBoxesWithOverflow;
-static FloatRect computeBoundsForUnderline(GraphicsContext& context, const FloatPoint& topleft, float length, bool printing, bool& shouldAntialias)
-{
- float thickness = std::max(context.strokeThickness(), 0.5f);
-
- FloatRect bounds(topleft, FloatSize(length, thickness));
-
- shouldAntialias = true;
-
- if (printing || context.paintingDisabled() || !context.getCTM(GraphicsContext::DefinitelyIncludeDeviceScale).preservesAxisAlignment())
- return bounds;
-
- // On screen, use a minimum thickness of 1.0 in user space (later rounded to an integral number in device space).
- FloatRect adjustedBounds = bounds;
- adjustedBounds.setHeight(std::max(thickness, 1.0f));
-
- // FIXME: This should be done a better way.
- // We try to round all parameters to integer boundaries in device space. If rounding pixels in device space
- // makes our thickness more than double, then there must be a shrinking-scale factor and rounding to pixels
- // in device space will make the underlines too thick.
- FloatRect lineRect = context.roundToDevicePixels(adjustedBounds, GraphicsContext::RoundAllSides);
- if (lineRect.height() < thickness * 2.0) {
- shouldAntialias = false;
- return lineRect;
- }
-
- return bounds;
-}
-
-static void drawLineForText(GraphicsContext& context, const FloatPoint& topleft, float width, bool printing)
-{
- if (width <= 0)
- return;
-
- bool shouldAntialias;
-
- FloatRect underlineBounds = computeBoundsForUnderline(context, topleft, width, printing, shouldAntialias);
-
- bool wasAntialiasing = context.shouldAntialias();
- context.setShouldAntialias(shouldAntialias);
- context.drawLineForText(underlineBounds, printing);
- context.setShouldAntialias(wasAntialiasing);
-}
-
void InlineTextBox::destroy(RenderArena& arena)
{
if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow)
@@ -1047,14 +1004,14 @@
break;
}
default:
- drawLineForText(*context, FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting);
+ context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting);
if (decorationStyle == TextDecorationStyleDouble)
- drawLineForText(*context, FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset + doubleOffset), width, isPrinting);
+ context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset + doubleOffset), width, isPrinting);
}
#else
// Leave one pixel of white between the baseline and the underline.
- drawLineForText(*context, FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting);
+ context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting);
#endif // CSS3_TEXT
}
if (deco & TextDecorationOverline) {
@@ -1069,10 +1026,10 @@
}
default:
#endif // CSS3_TEXT
- drawLineForText(*context, localOrigin, width, isPrinting);
+ context->drawLineForText(localOrigin, width, isPrinting);
#if ENABLE(CSS3_TEXT)
if (decorationStyle == TextDecorationStyleDouble)
- drawLineForText(*context, FloatPoint(localOrigin.x(), localOrigin.y() - doubleOffset), width, isPrinting);
+ context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() - doubleOffset), width, isPrinting);
}
#endif // CSS3_TEXT
}
@@ -1088,10 +1045,10 @@
}
default:
#endif // CSS3_TEXT
- drawLineForText(*context, FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting);
+ context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting);
#if ENABLE(CSS3_TEXT)
if (decorationStyle == TextDecorationStyleDouble)
- drawLineForText(*context, FloatPoint(localOrigin.x(), localOrigin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting);
+ context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting);
}
#endif // CSS3_TEXT
}
@@ -1339,7 +1296,7 @@
ctx->setStrokeColor(underline.color, renderer().style().colorSpace());
ctx->setStrokeThickness(lineThickness);
- drawLineForText(*ctx, FloatPoint(boxOrigin.x() + start, boxOrigin.y() + logicalHeight() - lineThickness), width, renderer().document().printing());
+ ctx->drawLineForText(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + logicalHeight() - lineThickness), width, renderer().document().printing());
}
int InlineTextBox::caretMinOffset() const