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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/InlineFlowBox.h ('k') | Source/core/rendering/InlineTextBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1126 }
1127 1127
1128 if (paintInfo.phase == PaintPhaseMask) 1128 if (paintInfo.phase == PaintPhaseMask)
1129 return; 1129 return;
1130 1130
1131 PaintPhase paintPhase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPh aseOutline : paintInfo.phase; 1131 PaintPhase paintPhase = paintInfo.phase == PaintPhaseChildOutlines ? PaintPh aseOutline : paintInfo.phase;
1132 PaintInfo childInfo(paintInfo); 1132 PaintInfo childInfo(paintInfo);
1133 childInfo.phase = paintPhase; 1133 childInfo.phase = paintPhase;
1134 childInfo.updatePaintingRootForChildren(&renderer()); 1134 childInfo.updatePaintingRootForChildren(&renderer());
1135 1135
1136 // Paint our children. 1136 float decorationThickness = 0;
1137 float finalThickness = 0;
1138 float maxDecorationThickness = 0;
1139 float minDecorationThickness = 65536.0f;
1140
1141 // Paint our childrens and calculate underline thickness
1137 if (paintPhase != PaintPhaseSelfOutline) { 1142 if (paintPhase != PaintPhaseSelfOutline) {
1143 InlineBox * start = 0;
1144 InlineBox * end = 0;
1145
1138 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 1146 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
1139 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPai ntingLayer()) 1147 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPai ntingLayer()) {
1140 curr->paint(childInfo, paintOffset, lineTop, lineBottom); 1148 curr->paint(childInfo, paintOffset, lineTop, lineBottom);
1149 curr->getPaintDecorationSyle(childInfo, paintOffset, &decoration Thickness);
1150 if (decorationThickness) {
1151 if (maxDecorationThickness < decorationThickness)
1152 maxDecorationThickness = decorationThickness;
1153
1154 if (minDecorationThickness > decorationThickness)
1155 minDecorationThickness = decorationThickness;
1156
1157 if (!start)
1158 start = curr;
1159 end = curr;
1160 } else if (end != start) {
1161 // found node where decoration style is not applied, ie; nor mal text node
1162 // lets apply uniform underline from start to end Text Nodes
1163 // We have underline thickness now, let draw it
1164 end = end->nextOnLine();
1165 finalThickness = (minDecorationThickness + maxDecorationThic kness) / 2.0f;
1166 for (InlineBox* curr1 = start; curr1 != end; curr1 = curr1-> nextOnLine())
1167 curr1->paintDecorationStyle(childInfo, paintOffset, line Top, lineBottom, finalThickness);
1168
1169 finalThickness = 0;
1170 maxDecorationThickness = 0;
1171 minDecorationThickness = 65536.0f;
1172 start = end = 0;
1173 } else if ((decorationThickness) && (end == start)) {
1174 start->paintDecorationStyle(childInfo, paintOffset, lineTop, lineBottom, finalThickness);
1175 finalThickness = 0;
1176 maxDecorationThickness = 0;
1177 minDecorationThickness = 65536.0f;
1178 start = end = 0;
1179 }
1180 }
1181 }
1182
1183 if (start && end) {
1184 end = end->nextOnLine();
1185 finalThickness = (minDecorationThickness + maxDecorationThickness) / 2.0f;
1186 for (InlineBox* curr1 = start; curr1 != end; curr1 = curr1->nextOnLi ne())
1187 curr1->paintDecorationStyle(childInfo, paintOffset, lineTop, lin eBottom, finalThickness);
1188
1189 finalThickness = 0;
1190 maxDecorationThickness = 0;
1191 minDecorationThickness = 65536.0f;
1192 start = end = 0;
1141 } 1193 }
1142 } 1194 }
1143 } 1195 }
1144 1196
1145 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op) 1197 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
1146 { 1198 {
1147 if (!fillLayer) 1199 if (!fillLayer)
1148 return; 1200 return;
1149 paintFillLayers(paintInfo, c, fillLayer->next(), rect, op); 1201 paintFillLayers(paintInfo, c, fillLayer->next(), rect, op);
1150 paintFillLayer(paintInfo, c, fillLayer, rect, op); 1202 paintFillLayer(paintInfo, c, fillLayer, rect, op);
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 ASSERT(child->prevOnLine() == prev); 1695 ASSERT(child->prevOnLine() == prev);
1644 prev = child; 1696 prev = child;
1645 } 1697 }
1646 ASSERT(prev == m_lastChild); 1698 ASSERT(prev == m_lastChild);
1647 #endif 1699 #endif
1648 } 1700 }
1649 1701
1650 #endif 1702 #endif
1651 1703
1652 } // namespace WebCore 1704 } // namespace WebCore
OLDNEW
« 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