Index: Source/core/rendering/InlineFlowBox.cpp |
diff --git a/Source/core/rendering/InlineFlowBox.cpp b/Source/core/rendering/InlineFlowBox.cpp |
index b1814adbde2b702cb8ea74996232465335de648e..c849627cf79e22ead24109aee959c857a389c315 100644 |
--- a/Source/core/rendering/InlineFlowBox.cpp |
+++ b/Source/core/rendering/InlineFlowBox.cpp |
@@ -1133,11 +1133,63 @@ void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, |
childInfo.phase = paintPhase; |
childInfo.updatePaintingRootForChildren(&renderer()); |
- // Paint our children. |
+ float decorationThickness = 0; |
+ float finalThickness = 0; |
+ float maxDecorationThickness = 0; |
+ float minDecorationThickness = 65536.0f; |
+ |
+ // Paint our childrens and calculate underline thickness |
if (paintPhase != PaintPhaseSelfOutline) { |
+ InlineBox * start = 0; |
+ InlineBox * end = 0; |
+ |
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
- if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintingLayer()) |
+ if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintingLayer()) { |
curr->paint(childInfo, paintOffset, lineTop, lineBottom); |
+ curr->getPaintDecorationSyle(childInfo, paintOffset, &decorationThickness); |
+ if (decorationThickness) { |
+ if (maxDecorationThickness < decorationThickness) |
+ maxDecorationThickness = decorationThickness; |
+ |
+ if (minDecorationThickness > decorationThickness) |
+ minDecorationThickness = decorationThickness; |
+ |
+ if (!start) |
+ start = curr; |
+ end = curr; |
+ } else if (end != start) { |
+ // found node where decoration style is not applied, ie; normal text node |
+ // lets apply uniform underline from start to end Text Nodes |
+ // We have underline thickness now, let draw it |
+ end = end->nextOnLine(); |
+ finalThickness = (minDecorationThickness + maxDecorationThickness) / 2.0f; |
+ for (InlineBox* curr1 = start; curr1 != end; curr1 = curr1->nextOnLine()) |
+ curr1->paintDecorationStyle(childInfo, paintOffset, lineTop, lineBottom, finalThickness); |
+ |
+ finalThickness = 0; |
+ maxDecorationThickness = 0; |
+ minDecorationThickness = 65536.0f; |
+ start = end = 0; |
+ } else if ((decorationThickness) && (end == start)) { |
+ start->paintDecorationStyle(childInfo, paintOffset, lineTop, lineBottom, finalThickness); |
+ finalThickness = 0; |
+ maxDecorationThickness = 0; |
+ minDecorationThickness = 65536.0f; |
+ start = end = 0; |
+ } |
+ } |
+ } |
+ |
+ if (start && end) { |
+ end = end->nextOnLine(); |
+ finalThickness = (minDecorationThickness + maxDecorationThickness) / 2.0f; |
+ for (InlineBox* curr1 = start; curr1 != end; curr1 = curr1->nextOnLine()) |
+ curr1->paintDecorationStyle(childInfo, paintOffset, lineTop, lineBottom, finalThickness); |
+ |
+ finalThickness = 0; |
+ maxDecorationThickness = 0; |
+ minDecorationThickness = 65536.0f; |
+ start = end = 0; |
} |
} |
} |