WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-130657-20140414002023.patch (text/plain), 16.43 KB, created by
Jeongeun Kim
on 2014-04-13 08:20:40 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jeongeun Kim
Created:
2014-04-13 08:20:40 PDT
Size:
16.43 KB
patch
obsolete
>Subversion Revision: 167179 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fd67640399188dd266d8fdb5d79af72b3b4d5e68..aae43defc17ab9f23ccfe761d60524465382b12e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2014-04-13 Jeongeun Kim <je_julie.kim@samsung.com> >+ >+ Link underline thickness should be uniform. >+ https://bugs.webkit.org/show_bug.cgi?id=130657. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Extended RenderObject::getTextDecorationColors for RenderStyle. >+ It has output parameter for RenderStyle Map which has each RenderStyle Info. >+ Using it, we can find render style which has decoration property and >+ set thickness from it. >+ According to firstLine style, >+ It could has difference thickness for each decoration such as underline and overline. >+ So, I moved location for setting thickness to set per decoration. >+ >+ Test: fast/css3-text/css3-text-decoration/text-decoration-unified-thickness.html >+ >+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: >+ (AXAttributeStringSetStyle): >+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: >+ (AXAttributeStringSetStyle): >+ * rendering/InlineTextBox.cpp: >+ (WebCore::getThicknessForDecoration): >+ (WebCore::InlineTextBox::paintDecoration): >+ * rendering/RenderObject.cpp: >+ (WebCore::RenderObject::getTextDecorationColors): >+ * rendering/RenderObject.h: >+ > 2014-04-11 Tim Horton <timothy_horton@apple.com> > > Lots of compositing test failures after r167152 >diff --git a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >index 6d21acb15f22cf847fc48e184d76080d4710a86f..6e917d8091e6cb4761a99c2a14d4c2cb80936c1c 100644 >--- a/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >+++ b/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >@@ -1592,7 +1592,8 @@ static void AXAttributeStringSetStyle(NSMutableAttributedString* attrString, Ren > // 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); >+ HashMap<int, RenderStyle*> styleMap; >+ renderer->getTextDecorationColors(decor, underline, overline, linethrough, styleMap); > > if (decor & TextDecorationUnderline) > AXAttributeStringSetNumber(attrString, UIAccessibilityTokenUnderline, [NSNumber numberWithBool:YES], range); >diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >index 40e9bb3251d38800de90aa287256f8d9b7a93cf8..e681c31371eb67fa08222f559849ce519e4d413d 100644 >--- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >+++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >@@ -863,7 +863,8 @@ static void AXAttributeStringSetStyle(NSMutableAttributedString* attrString, Ren > // 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); >+ HashMap<int, RenderStyle*> styleMap; >+ renderer->getTextDecorationColors(decor, underline, overline, linethrough, styleMap); > > if ((decor & TextDecorationUnderline) != 0) { > AXAttributeStringSetNumber(attrString, NSAccessibilityUnderlineTextAttribute, [NSNumber numberWithBool:YES], range); >diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp >index aff87563f36753dfcd20a54cb5af87780cc59b1b..ffcf133212fa113cb31631b582fae247ce7c2815 100644 >--- a/Source/WebCore/rendering/InlineTextBox.cpp >+++ b/Source/WebCore/rendering/InlineTextBox.cpp >@@ -985,6 +985,18 @@ static void strokeWavyTextDecoration(GraphicsContext& context, FloatPoint& p1, F > context.strokePath(path); > } > >+static float getThicknessForDecoration(bool isFirstLine, RenderStyle* firstLineStyle, RenderStyle* style, const float baseThickness) >+{ >+ const float textDecorationBaseFontSize = 16; >+ RenderStyle* baseStyle = style; >+ if (isFirstLine && firstLineStyle) >+ baseStyle = firstLineStyle; >+ >+ float fontSizeScaling = baseStyle ? baseStyle->fontSize() / textDecorationBaseFontSize : 1.0f; >+ float strokeThickness = roundf(baseThickness * fontSizeScaling); >+ return strokeThickness; >+} >+ > void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& boxOrigin, TextDecoration decoration, TextDecorationStyle decorationStyle, const ShadowData* shadow, TextPainter& textPainter) > { > #if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK) >@@ -1007,19 +1019,16 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& > } > > // Get the text decoration colors. >+ // Outputs from getTextDecorationColors has HashMap for RenderStyle which has decoration property. > Color underline, overline, linethrough; >- renderer().getTextDecorationColors(decoration, underline, overline, linethrough, true); >+ HashMap<int, RenderStyle*> styleMap; >+ renderer().getTextDecorationColors(decoration, underline, overline, linethrough, styleMap, true); >+ HashMap<int, RenderStyle*> firstLineStyleMap; > if (isFirstLine()) >- renderer().getTextDecorationColors(decoration, underline, overline, linethrough, true, true); >+ renderer().getTextDecorationColors(decoration, underline, overline, linethrough, firstLineStyleMap, true, true); > > // Use a special function for underlines to get the positioning exactly right. > bool isPrinting = renderer().document().printing(); >- >- const float textDecorationBaseFontSize = 16; >- float fontSizeScaling = renderer().style().fontSize() / textDecorationBaseFontSize; >- float strokeThickness = roundf(textDecorationThickness * fontSizeScaling); >- context.setStrokeThickness(strokeThickness); >- > bool linesAreOpaque = !isPrinting && (!(decoration & TextDecorationUnderline) || underline.alpha() == 255) && (!(decoration & TextDecorationOverline) || overline.alpha() == 255) && (!(decoration & TextDecorationLineThrough) || linethrough.alpha() == 255); > > const RenderStyle& lineStyle = this->lineStyle(); >@@ -1067,6 +1076,8 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& > > context.setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle)); > if (decoration & TextDecorationUnderline) { >+ float thickness = getThicknessForDecoration(isFirstLine(), firstLineStyleMap.get(TextDecorationUnderline), styleMap.get(TextDecorationUnderline), textDecorationThickness); >+ context.setStrokeThickness(thickness); > context.setStrokeColor(underline, colorSpace); > TextUnderlinePosition underlinePosition = lineStyle.textUnderlinePosition(); > const int underlineOffset = computeUnderlineOffset(underlinePosition, lineStyle.fontMetrics(), this, textDecorationThickness); >@@ -1091,6 +1102,8 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& > } > } > if (decoration & TextDecorationOverline) { >+ float thickness = getThicknessForDecoration(isFirstLine(), firstLineStyleMap.get(TextDecorationOverline), styleMap.get(TextDecorationOverline), textDecorationThickness); >+ context.setStrokeThickness(thickness); > context.setStrokeColor(overline, colorSpace); > switch (decorationStyle) { > case TextDecorationStyleWavy: { >@@ -1111,6 +1124,8 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& > } > } > if (decoration & TextDecorationLineThrough) { >+ float thickness = getThicknessForDecoration(isFirstLine(), firstLineStyleMap.get(TextDecorationLineThrough), styleMap.get(TextDecorationLineThrough), textDecorationThickness); >+ context.setStrokeThickness(thickness); > context.setStrokeColor(linethrough, colorSpace); > switch (decorationStyle) { > case TextDecorationStyleWavy: { >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index eb1bc0011d0b202064b9fd975569683ca8590e0d..27ca8b9a65398b7fce9fb3d2010989568abdf422 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -2142,8 +2142,7 @@ static Color decorationColor(RenderStyle* style) > return result; > } > >-void RenderObject::getTextDecorationColors(int decorations, Color& underline, Color& overline, >- Color& linethrough, bool quirksMode, bool firstlineStyle) >+void RenderObject::getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, HashMap<int, RenderStyle*>& styleMap, bool quirksMode, bool firstlineStyle) > { > RenderObject* curr = this; > RenderStyle* styleToUse = 0; >@@ -2158,14 +2157,17 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co > if (currDecs & TextDecorationUnderline) { > decorations &= ~TextDecorationUnderline; > underline = resultColor; >+ styleMap.set(TextDecorationUnderline, styleToUse); > } > if (currDecs & TextDecorationOverline) { > decorations &= ~TextDecorationOverline; > overline = resultColor; >+ styleMap.set(TextDecorationOverline, styleToUse); > } > if (currDecs & TextDecorationLineThrough) { > decorations &= ~TextDecorationLineThrough; > linethrough = resultColor; >+ styleMap.set(TextDecorationLineThrough, styleToUse); > } > } > if (curr->isRubyText()) >@@ -2179,12 +2181,18 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co > if (decorations && curr) { > styleToUse = firstlineStyle ? &curr->firstLineStyle() : &curr->style(); > resultColor = decorationColor(styleToUse); >- if (decorations & TextDecorationUnderline) >+ if (decorations & TextDecorationUnderline) { > underline = resultColor; >- if (decorations & TextDecorationOverline) >+ styleMap.set(TextDecorationUnderline, styleToUse); >+ } >+ if (decorations & TextDecorationOverline) { > overline = resultColor; >- if (decorations & TextDecorationLineThrough) >+ styleMap.set(TextDecorationOverline, styleToUse); >+ } >+ if (decorations & TextDecorationLineThrough) { > linethrough = resultColor; >+ styleMap.set(TextDecorationLineThrough, styleToUse); >+ } > } > } > >diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h >index 423e3b48d9d8d341108b7ed0aa99a7a3d66edd45..2ebfa60b13e7bc12c570b06978ef274b24988412 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -36,6 +36,7 @@ > #include "ScrollBehavior.h" > #include "StyleInheritedData.h" > #include "TextAffinity.h" >+#include <wtf/HashMap.h> > #include <wtf/HashSet.h> > > namespace WebCore { >@@ -716,7 +717,10 @@ public: > > virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const; > >- void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, bool quirksMode = false, bool firstlineStyle = false); >+ // You can get Color for decoration such as underline, overline and linethrough. >+ // The 5th param is for RenderStyle Map which has decoration property. >+ // RenderStyle Map has RenderStyle per each decoration. >+ void getTextDecorationColors(int decorations, Color& underline, Color& overline, Color& linethrough, HashMap<int, RenderStyle*>& styleMap, bool quirksMode = false, 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' >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9722b3f788e50b621cc6ed3e73ab380fc0884983..f3dd34838525c572e4e2eea2beaddb8fce0ef663 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2014-04-13 Jeongeun Kim <je_julie.kim@samsung.com> >+ >+ Link underline thickness should be uniform. >+ https://bugs.webkit.org/show_bug.cgi?id=130657. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It tests thickness several nodes under text-decoration property. >+ It also tests thickness for each text-decoration >+ such as underline and overline with firstline style. >+ >+ * fast/css3-text/css3-text-decoration/text-decoration-unified-thickness-expected.html: Added. >+ * fast/css3-text/css3-text-decoration/text-decoration-unified-thickness.html: Added. >+ > 2014-04-11 Jon Honeycutt <jhoneycutt@apple.com> > > Assertion failure changing select element size during focus event >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-unified-thickness-expected.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-unified-thickness-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6ec5ac51230a9a42c64c6ec6e8d426c87fad0298 >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-unified-thickness-expected.html >@@ -0,0 +1,32 @@ >+<html> >+<head> >+ <style> >+ a{text-decoration:underline;font-size:40px} >+ div{font-size:150%} >+ p { text-decoration: underline; font-size:50px;} >+ #firstline1 { color: green; font-size:2em} >+ #firstline2 { color: green; text-decoration: overline; font-size:1.5em} >+ #firstline3 { color: green; text-decoration: underline; font-size:300%} >+ </style> >+</head> >+<body> >+ <div>The line below should be uniform</div> >+ <a href="#"> >+ <div> >+ <span style="font-size:2em"> </span> >+ </div> >+ </a> >+ <div>The first 'Hello, World!' should have black underline.</div> >+ <p> >+ <span id="firstline1">Hello,</span><br/><span>World!</span> >+ </p> >+ <div>The second 'Hello, World!' should have black underline and 'Hello,' should have thicker, 1.5em, green overline.</div> >+ <p> >+ <span id="firstline2">Hello,</span><br/><span>World!</span> >+ </p> >+ <div>The third 'Hello,' should have green underline with 300% thickness and 'World!' should have black underline.</div> >+ <p> >+ <span id="firstline3">Hello,</span><br/><span>World!</span> >+ </p> >+</body> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-unified-thickness.html b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-unified-thickness.html >new file mode 100644 >index 0000000000000000000000000000000000000000..42b3b55fa3fd80f5633eec8030f2f2ebcafdf659 >--- /dev/null >+++ b/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-unified-thickness.html >@@ -0,0 +1,27 @@ >+<html> >+<head> >+ <style> >+ a{text-decoration:underline;font-size:40px} >+ div{font-size:150%} >+ #parent1, #parent2, #parent3 { text-decoration: underline;font-size:50px;} >+ #parent1:first-line { color: green; font-size:2em} >+ #parent2:first-line {color: green; text-decoration: overline;font-size:1.5em} >+ #parent3:first-line {color: green; text-decoration: underline;font-size:300%} >+ </style> >+</head> >+<body> >+ <div>The line below should be uniform</div> >+ <a href="#"> >+ <div> >+ <span style="font-size:2em"> </span> >+ <span style="font-size;:1.1em"> </span> >+ </div> >+ </a> >+ <div>The first 'Hello, World!' should have black underline.</div> >+ <p id="parent1">Hello,<br/>World!</p> >+ <div>The second 'Hello, World!' should have black underline and 'Hello,' should have thicker, 1.5em, green overline.</div> >+ <p id="parent2">Hello,<br/>World!</p> >+ <div>The third 'Hello,' should have green underline with 300% thickness and 'World!' should have black underline.</div> >+ <p id="parent3">Hello,<br/>World!</p> >+</body> >+</html> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 130657
:
228734
|
228740
|
228742
|
228743
|
229205
|
229220
|
229221
|
229223
|
229225
|
229233
|
230147
|
230169
|
232097
|
232102