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

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

Issue 203273003: Underline Thickness is not uniform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comment fix Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/InlineFlowBox.h ('k') | Source/core/rendering/InlineTextBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
}
« no previous file with comments | « Source/core/rendering/InlineFlowBox.h ('k') | Source/core/rendering/InlineTextBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698