Diff
Modified: trunk/LayoutTests/ChangeLog (180272 => 180273)
--- trunk/LayoutTests/ChangeLog 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/LayoutTests/ChangeLog 2015-02-18 19:00:49 UTC (rev 180273)
@@ -1,3 +1,14 @@
+2015-02-16 David Hyatt <hy...@apple.com>
+
+ Wrong element's style is used for text-decoration-style.
+ https://bugs.webkit.org/show_bug.cgi?id=141673
+ <rdar://problem/19876774>
+
+ Reviewed by Dean Jackson.
+
+ * fast/text/text-underline-style-expected.html: Added.
+ * fast/text/text-underline-style.html: Added.
+
2015-02-18 Myles C. Maxfield <mmaxfi...@apple.com>
Update more test expected results after r177774
Added: trunk/LayoutTests/fast/text/text-underline-style-expected.html (0 => 180273)
--- trunk/LayoutTests/fast/text/text-underline-style-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/text-underline-style-expected.html 2015-02-18 19:00:49 UTC (rev 180273)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ibooks="http://apple.com/ibooks/html-extensions" xmlns:epub="http://www.idpf.org/2007/ops">
+<body style="overflow:hidden">
+<p>Test to make sure the dotted style is properly obtained from an enclosing ancestor.
+</p>
+
+<p style="text-decoration:underline;-webkit-text-decoration-style:double; color:green; -webkit-text-decoration-color:blue">This text should have a double blue underline.</p>
\ No newline at end of file
Added: trunk/LayoutTests/fast/text/text-underline-style.html (0 => 180273)
--- trunk/LayoutTests/fast/text/text-underline-style.html (rev 0)
+++ trunk/LayoutTests/fast/text/text-underline-style.html 2015-02-18 19:00:49 UTC (rev 180273)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ibooks="http://apple.com/ibooks/html-extensions" xmlns:epub="http://www.idpf.org/2007/ops">
+<body style="overflow:hidden">
+<p>Test to make sure the dotted style is properly obtained from an enclosing ancestor.
+</p>
+
+<p style="text-decoration:underline;-webkit-text-decoration-style:double; color:blue;"><span style="-webkit-text-decoration-style:wavy; color:green">This text should have a double blue underline.</p>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (180272 => 180273)
--- trunk/Source/WebCore/ChangeLog 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/ChangeLog 2015-02-18 19:00:49 UTC (rev 180273)
@@ -1,3 +1,30 @@
+2015-02-16 David Hyatt <hy...@apple.com>
+
+ Wrong element's style is used for text-decoration-style.
+ https://bugs.webkit.org/show_bug.cgi?id=141673
+ <rdar://problem/19876774>
+
+ Reviewed by Dean Jackson.
+
+ Added fast/text/text-underline-style.html
+
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (AXAttributeStringSetStyle):
+ Add arguments for fetching styles.
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::paint):
+ (WebCore::InlineTextBox::paintDecoration):
+ * rendering/InlineTextBox.h:
+ Remove the passed in TextDecorationStyle and instead patch the code to fetch the styles in the same
+ way it fetches the colors.
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::getTextDecorationColorsAndStyles):
+ (WebCore::RenderObject::getTextDecorationColors): Deleted.
+ * rendering/RenderObject.h:
+ Add style fetching to the same function that fetches colors and rename it.
+
2015-02-18 David Kilzer <ddkil...@apple.com>
REGRESSION (r180260): Try to fix incremental builds by changing UserContentController.cpp
Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (180272 => 180273)
--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2015-02-18 19:00:49 UTC (rev 180273)
@@ -1762,10 +1762,9 @@
int decor = style.textDecorationsInEffect();
if ((decor & (TextDecorationUnderline | TextDecorationLineThrough)) != 0) {
- // find colors using quirk mode approach (strict mode would use current
- // color for all but the root line box, which would use getTextDecorationColors)
- Color underline, overline, linethrough;
- renderer->getTextDecorationColors(decor, underline, overline, linethrough);
+ Color underlineColor, overlineColor, linethroughColor;
+ TextDecorationStyle underlineStyle, overlineStyle, linethroughStyle;
+ renderer->getTextDecorationColorsAndStyles(decor, underlineColor, overlineColor, linethroughColor, underlineStyle, overlineStyle, linethroughStyle);
if (decor & TextDecorationUnderline)
AXAttributeStringSetNumber(attrString, UIAccessibilityTokenUnderline, [NSNumber numberWithBool:YES], range);
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (180272 => 180273)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2015-02-18 19:00:49 UTC (rev 180273)
@@ -882,19 +882,19 @@
}
if ((decor & (TextDecorationUnderline | TextDecorationLineThrough)) != 0) {
- // find colors using quirk mode approach (strict mode would use current
- // color for all but the root line box, which would use getTextDecorationColors)
- Color underline, overline, linethrough;
- renderer->getTextDecorationColors(decor, underline, overline, linethrough);
+ // FIXME: Should the underline style be reported here?
+ Color underlineColor, overlineColor, linethroughColor;
+ TextDecorationStyle underlineStyle, overlineStyle, linethroughStyle;
+ renderer->getTextDecorationColorsAndStyles(decor, underlineColor, overlineColor, linethroughColor, underlineStyle, overlineStyle, linethroughStyle);
if ((decor & TextDecorationUnderline) != 0) {
AXAttributeStringSetNumber(attrString, NSAccessibilityUnderlineTextAttribute, [NSNumber numberWithBool:YES], range);
- AXAttributeStringSetColor(attrString, NSAccessibilityUnderlineColorTextAttribute, nsColor(underline), range);
+ AXAttributeStringSetColor(attrString, NSAccessibilityUnderlineColorTextAttribute, nsColor(underlineColor), range);
}
if ((decor & TextDecorationLineThrough) != 0) {
AXAttributeStringSetNumber(attrString, NSAccessibilityStrikethroughTextAttribute, [NSNumber numberWithBool:YES], range);
- AXAttributeStringSetColor(attrString, NSAccessibilityStrikethroughColorTextAttribute, nsColor(linethrough), range);
+ AXAttributeStringSetColor(attrString, NSAccessibilityStrikethroughColorTextAttribute, nsColor(linethroughColor), range);
}
}
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (180272 => 180273)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2015-02-18 19:00:49 UTC (rev 180273)
@@ -622,7 +622,7 @@
updateGraphicsContext(context, textPaintStyle);
if (combinedText)
context.concatCTM(rotation(boxRect, Clockwise));
- paintDecoration(context, boxOrigin, textDecorations, lineStyle.textDecorationStyle(), textShadow, textPainter);
+ paintDecoration(context, boxOrigin, textDecorations, textShadow, textPainter);
if (combinedText)
context.concatCTM(rotation(boxRect, Counterclockwise));
}
@@ -895,7 +895,7 @@
context.strokePath(path);
}
-void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& boxOrigin, TextDecoration decoration, TextDecorationStyle decorationStyle, const ShadowData* shadow, TextPainter& textPainter)
+void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& boxOrigin, TextDecoration decoration, const ShadowData* shadow, TextPainter& textPainter)
{
#if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
UNUSED_PARAM(textPainter);
@@ -914,10 +914,11 @@
}
// Get the text decoration colors.
- Color underline, overline, linethrough;
- renderer().getTextDecorationColors(decoration, underline, overline, linethrough);
+ Color underlineColor, overlineColor, linethroughColor;
+ TextDecorationStyle underlineStyle, overlineStyle, linethroughStyle;
+ renderer().getTextDecorationColorsAndStyles(decoration, underlineColor, overlineColor, linethroughColor, underlineStyle, overlineStyle, linethroughStyle);
if (isFirstLine())
- renderer().getTextDecorationColors(decoration, underline, overline, linethrough, true);
+ renderer().getTextDecorationColorsAndStyles(decoration, underlineColor, overlineColor, linethroughColor, underlineStyle, overlineStyle, linethroughStyle, true);
// Use a special function for underlines to get the positioning exactly right.
bool isPrinting = renderer().document().printing();
@@ -925,7 +926,7 @@
float textDecorationThickness = textDecorationStrokeThickness(renderer().style().fontSize());
context.setStrokeThickness(textDecorationThickness);
- bool linesAreOpaque = !isPrinting && (!(decoration & TextDecorationUnderline) || underline.alpha() == 255) && (!(decoration & TextDecorationOverline) || overline.alpha() == 255) && (!(decoration & TextDecorationLineThrough) || linethrough.alpha() == 255);
+ bool linesAreOpaque = !isPrinting && (!(decoration & TextDecorationUnderline) || underlineColor.alpha() == 255) && (!(decoration & TextDecorationOverline) || overlineColor.alpha() == 255) && (!(decoration & TextDecorationLineThrough) || linethroughColor.alpha() == 255);
const RenderStyle& lineStyle = this->lineStyle();
int baseline = lineStyle.fontMetrics().ascent();
@@ -970,13 +971,13 @@
float wavyOffset = wavyOffsetFromDecoration();
- context.setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle));
// These decorations should match the visual overflows computed in visualOverflowForDecorations()
if (decoration & TextDecorationUnderline) {
- context.setStrokeColor(underline, colorSpace);
+ context.setStrokeColor(underlineColor, colorSpace);
+ context.setStrokeStyle(textDecorationStyleToStrokeStyle(underlineStyle));
const int underlineOffset = computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), this, textDecorationThickness);
- switch (decorationStyle) {
+ switch (underlineStyle) {
case TextDecorationStyleWavy: {
FloatPoint start(localOrigin.x(), localOrigin.y() + underlineOffset + wavyOffset);
FloatPoint end(localOrigin.x() + width, localOrigin.y() + underlineOffset + wavyOffset);
@@ -987,17 +988,18 @@
#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
if ((lineStyle.textDecorationSkip() == TextDecorationSkipInk || lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && isHorizontal()) {
if (!context.paintingDisabled()) {
- drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset, width, isPrinting, decorationStyle == TextDecorationStyleDouble);
+ drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset, width, isPrinting, underlineStyle == TextDecorationStyleDouble);
}
} else
// FIXME: Need to support text-decoration-skip: none.
#endif // CSS3_TEXT_DECORATION_SKIP_INK
- context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting, decorationStyle == TextDecorationStyleDouble);
+ context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting, underlineStyle == TextDecorationStyleDouble);
}
}
if (decoration & TextDecorationOverline) {
- context.setStrokeColor(overline, colorSpace);
- switch (decorationStyle) {
+ context.setStrokeColor(overlineColor, colorSpace);
+ context.setStrokeStyle(textDecorationStyleToStrokeStyle(overlineStyle));
+ switch (overlineStyle) {
case TextDecorationStyleWavy: {
FloatPoint start(localOrigin.x(), localOrigin.y() - wavyOffset);
FloatPoint end(localOrigin.x() + width, localOrigin.y() - wavyOffset);
@@ -1008,16 +1010,17 @@
#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
if ((lineStyle.textDecorationSkip() == TextDecorationSkipInk || lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && isHorizontal()) {
if (!context.paintingDisabled())
- drawSkipInkUnderline(textPainter, context, localOrigin, 0, width, isPrinting, decorationStyle == TextDecorationStyleDouble);
+ drawSkipInkUnderline(textPainter, context, localOrigin, 0, width, isPrinting, overlineStyle == TextDecorationStyleDouble);
} else
// FIXME: Need to support text-decoration-skip: none.
#endif // CSS3_TEXT_DECORATION_SKIP_INK
- context.drawLineForText(localOrigin, width, isPrinting, decorationStyle == TextDecorationStyleDouble);
+ context.drawLineForText(localOrigin, width, isPrinting, overlineStyle == TextDecorationStyleDouble);
}
}
if (decoration & TextDecorationLineThrough) {
- context.setStrokeColor(linethrough, colorSpace);
- switch (decorationStyle) {
+ context.setStrokeColor(linethroughColor, colorSpace);
+ context.setStrokeStyle(textDecorationStyleToStrokeStyle(linethroughStyle));
+ switch (linethroughStyle) {
case TextDecorationStyleWavy: {
FloatPoint start(localOrigin.x(), localOrigin.y() + 2 * baseline / 3);
FloatPoint end(localOrigin.x() + width, localOrigin.y() + 2 * baseline / 3);
@@ -1025,7 +1028,7 @@
break;
}
default:
- context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting, decorationStyle == TextDecorationStyleDouble);
+ context.drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + 2 * baseline / 3), width, isPrinting, linethroughStyle == TextDecorationStyleDouble);
}
}
} while (shadow);
Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (180272 => 180273)
--- trunk/Source/WebCore/rendering/InlineTextBox.h 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h 2015-02-18 19:00:49 UTC (rev 180273)
@@ -153,7 +153,7 @@
void paintCompositionUnderline(GraphicsContext&, const FloatPoint& boxOrigin, const CompositionUnderline&);
private:
- void paintDecoration(GraphicsContext&, const FloatPoint& boxOrigin, TextDecoration, TextDecorationStyle, const ShadowData*, TextPainter&);
+ void paintDecoration(GraphicsContext&, const FloatPoint& boxOrigin, TextDecoration, const ShadowData*, TextPainter&);
void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, Color textColor);
void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (180272 => 180273)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2015-02-18 19:00:49 UTC (rev 180273)
@@ -2110,7 +2110,8 @@
return result;
}
-void RenderObject::getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool firstlineStyle)
+void RenderObject::getTextDecorationColorsAndStyles(int decorations, Color& underlineColor, Color& overlineColor, Color& linethroughColor,
+ TextDecorationStyle& underlineStyle, TextDecorationStyle& overlineStyle, TextDecorationStyle& linethroughStyle, bool firstlineStyle)
{
RenderObject* current = this;
RenderStyle* styleToUse = nullptr;
@@ -2124,15 +2125,18 @@
if (currDecs) {
if (currDecs & TextDecorationUnderline) {
decorations &= ~TextDecorationUnderline;
- underline = resultColor;
+ underlineColor = resultColor;
+ underlineStyle = styleToUse->textDecorationStyle();
}
if (currDecs & TextDecorationOverline) {
decorations &= ~TextDecorationOverline;
- overline = resultColor;
+ overlineColor = resultColor;
+ overlineStyle = styleToUse->textDecorationStyle();
}
if (currDecs & TextDecorationLineThrough) {
decorations &= ~TextDecorationLineThrough;
- linethrough = resultColor;
+ linethroughColor = resultColor;
+ linethroughStyle = styleToUse->textDecorationStyle();
}
}
if (current->isRubyText())
@@ -2146,12 +2150,18 @@
if (decorations && current) {
styleToUse = firstlineStyle ? ¤t->firstLineStyle() : ¤t->style();
resultColor = decorationColor(styleToUse);
- if (decorations & TextDecorationUnderline)
- underline = resultColor;
- if (decorations & TextDecorationOverline)
- overline = resultColor;
- if (decorations & TextDecorationLineThrough)
- linethrough = resultColor;
+ if (decorations & TextDecorationUnderline) {
+ underlineColor = resultColor;
+ underlineStyle = styleToUse->textDecorationStyle();
+ }
+ if (decorations & TextDecorationOverline) {
+ overlineColor = resultColor;
+ overlineStyle = styleToUse->textDecorationStyle();
+ }
+ if (decorations & TextDecorationLineThrough) {
+ linethroughColor = resultColor;
+ linethroughStyle = styleToUse->textDecorationStyle();
+ }
}
}
Modified: trunk/Source/WebCore/rendering/RenderObject.h (180272 => 180273)
--- trunk/Source/WebCore/rendering/RenderObject.h 2015-02-18 19:00:16 UTC (rev 180272)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2015-02-18 19:00:49 UTC (rev 180273)
@@ -706,7 +706,8 @@
virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
- void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool firstlineStyle = false);
+ void getTextDecorationColorsAndStyles(int decorations, Color& underlineColor, Color& overlineColor, Color& linethroughColor,
+ TextDecorationStyle& underlineStyle, TextDecorationStyle& overlineStyle, TextDecorationStyle& linethroughStyle, bool firstlineStyle = false);
// Return the RenderLayerModelObject in the container chain which is responsible for painting this object, or 0
// if painting is root-relative. This is the container that should be passed to the 'forRepaint'