diff --git a/Source/HtmlRenderer.WPF/Adapters/FontFamilyAdapter.cs b/Source/HtmlRenderer.WPF/Adapters/FontFamilyAdapter.cs
index a3ec7734d..1cb0db4f6 100644
--- a/Source/HtmlRenderer.WPF/Adapters/FontFamilyAdapter.cs
+++ b/Source/HtmlRenderer.WPF/Adapters/FontFamilyAdapter.cs
@@ -51,7 +51,12 @@ public override string Name
{
get
{
- string name = _fontFamily.FamilyNames[_xmlLanguage];
+ var name = string.Empty;
+ if (_fontFamily.FamilyNames.ContainsKey(_xmlLanguage))
+ {
+ name = _fontFamily.FamilyNames[_xmlLanguage];
+ }
+
if (string.IsNullOrEmpty(name))
{
foreach (var familyName in _fontFamily.FamilyNames)
diff --git a/Source/HtmlRenderer.WPF/Adapters/GraphicsAdapter.cs b/Source/HtmlRenderer.WPF/Adapters/GraphicsAdapter.cs
index d61bef4ca..357aa6a0a 100644
--- a/Source/HtmlRenderer.WPF/Adapters/GraphicsAdapter.cs
+++ b/Source/HtmlRenderer.WPF/Adapters/GraphicsAdapter.cs
@@ -200,8 +200,17 @@ public override void DrawString(string str, RFont font, RColor color, RPoint poi
point.X += rtl ? 96d / 72d * font.Size * width : 0;
glyphRendered = true;
- var glyphRun = new GlyphRun(glyphTypeface, rtl ? 1 : 0, false, 96d / 72d * font.Size, glyphs, Utils.ConvertRound(point), widths, null, null, null, null, null, null);
+ var wpfPoint = Utils.ConvertRound(point);
+ var glyphRun = new GlyphRun(glyphTypeface, rtl ? 1 : 0,
+ false, 96d / 72d * font.Size, glyphs,
+ wpfPoint, widths, null, null, null, null, null, null);
+
+ var guidelines = new GuidelineSet();
+ guidelines.GuidelinesX.Add(wpfPoint.X);
+ guidelines.GuidelinesY.Add(wpfPoint.Y);
+ _g.PushGuidelineSet(guidelines);
_g.DrawGlyphRun(colorConv, glyphRun);
+ _g.Pop();
}
}
diff --git a/Source/HtmlRenderer/Adapters/Entities/RRect.cs b/Source/HtmlRenderer/Adapters/Entities/RRect.cs
index 3ae148655..ebcdfe239 100644
--- a/Source/HtmlRenderer/Adapters/Entities/RRect.cs
+++ b/Source/HtmlRenderer/Adapters/Entities/RRect.cs
@@ -361,8 +361,8 @@ public void Inflate(double x, double y)
{
X -= x;
Y -= y;
- Width += 2f * x;
- Height += 2f * y;
+ Width += 2 * x;
+ Height += 2 * y;
}
///
diff --git a/Source/HtmlRenderer/Core/Dom/CssBox.cs b/Source/HtmlRenderer/Core/Dom/CssBox.cs
index b2cd3d984..e143189b6 100644
--- a/Source/HtmlRenderer/Core/Dom/CssBox.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssBox.cs
@@ -901,7 +901,7 @@ internal double GetMinimumWidth()
CssRect maxWidthWord = null;
GetMinimumWidth_LongestWord(this, ref maxWidth, ref maxWidthWord);
- double padding = 0f;
+ double padding = 0;
if (maxWidthWord != null)
{
var box = maxWidthWord.OwnerBox;
@@ -949,7 +949,7 @@ private static void GetMinimumWidth_LongestWord(CssBox box, ref double maxWidth,
/// the total margin
private static double GetWidthMarginDeep(CssBox box)
{
- double sum = 0f;
+ double sum = 0;
if (box.Size.Width > 90999 || (box.ParentBox != null && box.ParentBox.Size.Width > 90999))
{
while (box != null)
@@ -989,10 +989,10 @@ internal double GetMaximumBottom(CssBox startBox, double currentMaxBottom)
/// The total width the content can take without line wrapping (with padding).
internal void GetMinMaxWidth(out double minWidth, out double maxWidth)
{
- double min = 0f;
- double maxSum = 0f;
- double paddingSum = 0f;
- double marginSum = 0f;
+ double min = 0;
+ double maxSum = 0;
+ double paddingSum = 0;
+ double marginSum = 0;
GetMinMaxSumWords(this, ref min, ref maxSum, ref paddingSum, ref marginSum);
maxWidth = paddingSum + maxSum;
@@ -1112,7 +1112,7 @@ protected double MarginTopCollapse(CssBoxProperties prevSibling)
// fix for hr tag
if (value < 0.1 && HtmlTag != null && HtmlTag.Name == "hr")
{
- value = GetEmHeight() * 1.1f;
+ value = GetEmHeight() * 1.1;
}
return value;
@@ -1422,14 +1422,14 @@ protected void PaintDecoration(RGraphics g, RRect rectangle, bool isFirst, bool
if (string.IsNullOrEmpty(TextDecoration) || TextDecoration == CssConstants.None)
return;
- double y = 0f;
+ double y = 0;
if (TextDecoration == CssConstants.Underline)
{
y = Math.Round(rectangle.Top + ActualFont.UnderlineOffset);
}
else if (TextDecoration == CssConstants.LineThrough)
{
- y = rectangle.Top + rectangle.Height / 2f;
+ y = rectangle.Top + rectangle.Height / 2;
}
else if (TextDecoration == CssConstants.Overline)
{
diff --git a/Source/HtmlRenderer/Core/Dom/CssBoxFrame.cs b/Source/HtmlRenderer/Core/Dom/CssBoxFrame.cs
index 7bb6ed57f..bc2aa6740 100644
--- a/Source/HtmlRenderer/Core/Dom/CssBoxFrame.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssBoxFrame.cs
@@ -516,7 +516,7 @@ private void DrawTitle(RGraphics g, RRect rect)
{
if (_videoTitle != null && _imageWord.Width > 40 && _imageWord.Height > 40)
{
- var font = HtmlContainer.Adapter.GetFont("Arial", 9f, RFontStyle.Regular);
+ var font = HtmlContainer.Adapter.GetFont("Arial", 9.0, RFontStyle.Regular);
g.DrawRectangle(g.GetSolidBrush(RColor.FromArgb(160, 0, 0, 0)), rect.Left, rect.Top, rect.Width, ActualFont.Height + 7);
var titleRect = new RRect(rect.Left + 3, rect.Top + 3, rect.Width - 6, rect.Height - 6);
@@ -540,9 +540,9 @@ private void DrawPlay(RGraphics g, RRect rect)
RPoint[] points =
{
- new RPoint(left + size.Width / 3f + 1,top + 3 * size.Height / 4f),
- new RPoint(left + size.Width / 3f + 1, top + size.Height / 4f),
- new RPoint(left + 2 * size.Width / 3f + 1, top + size.Height / 2f)
+ new RPoint(left + size.Width / 3.0 + 1,top + 3 * size.Height / 4.0),
+ new RPoint(left + size.Width / 3.0 + 1, top + size.Height / 4.0),
+ new RPoint(left + 2 * size.Width / 3.0 + 1, top + size.Height / 2.0)
};
g.DrawPolygon(g.GetSolidBrush(RColor.White), points);
diff --git a/Source/HtmlRenderer/Core/Dom/CssBoxProperties.cs b/Source/HtmlRenderer/Core/Dom/CssBoxProperties.cs
index 7abfb53ed..859081eeb 100644
--- a/Source/HtmlRenderer/Core/Dom/CssBoxProperties.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssBoxProperties.cs
@@ -540,7 +540,16 @@ public string Position
public string LineHeight
{
get { return _lineHeight; }
- set { _lineHeight = string.Format(NumberFormatInfo.InvariantInfo, "{0}px", CssValueParser.ParseLength(value, Size.Height, this, CssConstants.Em)); }
+ set
+ {
+ _lineHeight = string.Format(
+ NumberFormatInfo.InvariantInfo,
+ "{0}px",
+ Double.TryParse(value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var val)
+ ? CssValueParser.ParseLength((val * ActualFont.Size).ToString(CultureInfo.InvariantCulture), Size.Height, this, CssConstants.Pt)
+ : CssValueParser.ParseLength(value, Size.Height, this, CssConstants.Em)
+ );
+ }
}
public string VerticalAlign
@@ -976,7 +985,7 @@ public double ActualBorderTopWidth
_actualBorderTopWidth = CssValueParser.GetActualBorderWidth(BorderTopWidth, this);
if (string.IsNullOrEmpty(BorderTopStyle) || BorderTopStyle == CssConstants.None)
{
- _actualBorderTopWidth = 0f;
+ _actualBorderTopWidth = 0.0f;
}
}
return _actualBorderTopWidth;
@@ -995,7 +1004,7 @@ public double ActualBorderLeftWidth
_actualBorderLeftWidth = CssValueParser.GetActualBorderWidth(BorderLeftWidth, this);
if (string.IsNullOrEmpty(BorderLeftStyle) || BorderLeftStyle == CssConstants.None)
{
- _actualBorderLeftWidth = 0f;
+ _actualBorderLeftWidth = 0.0;
}
}
return _actualBorderLeftWidth;
@@ -1014,7 +1023,7 @@ public double ActualBorderBottomWidth
_actualBorderBottomWidth = CssValueParser.GetActualBorderWidth(BorderBottomWidth, this);
if (string.IsNullOrEmpty(BorderBottomStyle) || BorderBottomStyle == CssConstants.None)
{
- _actualBorderBottomWidth = 0f;
+ _actualBorderBottomWidth = 0.0;
}
}
return _actualBorderBottomWidth;
@@ -1033,7 +1042,7 @@ public double ActualBorderRightWidth
_actualBorderRightWidth = CssValueParser.GetActualBorderWidth(BorderRightWidth, this);
if (string.IsNullOrEmpty(BorderRightStyle) || BorderRightStyle == CssConstants.None)
{
- _actualBorderRightWidth = 0f;
+ _actualBorderRightWidth = 0.0;
}
}
return _actualBorderRightWidth;
@@ -1169,7 +1178,7 @@ public double ActualCornerSw
///
public bool IsRounded
{
- get { return ActualCornerNe > 0f || ActualCornerNw > 0f || ActualCornerSe > 0f || ActualCornerSw > 0f; }
+ get { return ActualCornerNe > 0.0 || ActualCornerNw > 0.0 || ActualCornerSe > 0.0 || ActualCornerSw > 0.0; }
}
///
@@ -1237,7 +1246,7 @@ public double ActualBackgroundGradientAngle
{
if (double.IsNaN(_actualBackgroundGradientAngle))
{
- _actualBackgroundGradientAngle = CssValueParser.ParseNumber(BackgroundGradientAngle, 360f);
+ _actualBackgroundGradientAngle = CssValueParser.ParseNumber(BackgroundGradientAngle, 360.0);
}
return _actualBackgroundGradientAngle;
@@ -1322,7 +1331,7 @@ public RFont ActualFont
break;
}
- if (fsize <= 1f)
+ if (fsize <= 1.0)
{
fsize = CssConstants.FontSize;
}
@@ -1344,7 +1353,7 @@ public double ActualLineHeight
{
if (double.IsNaN(_actualLineHeight))
{
- _actualLineHeight = .9f * CssValueParser.ParseLength(LineHeight, Size.Height, this);
+ _actualLineHeight = .9 * CssValueParser.ParseLength(LineHeight, Size.Height, this);
}
return _actualLineHeight;
}
@@ -1499,7 +1508,6 @@ protected void InheritStyle(CssBox p, bool everything)
_visibility = p._visibility;
_textIndent = p._textIndent;
_textAlign = p._textAlign;
- _verticalAlign = p._verticalAlign;
_fontFamily = p._fontFamily;
_fontSize = p._fontSize;
_fontStyle = p._fontStyle;
@@ -1560,6 +1568,7 @@ protected void InheritStyle(CssBox p, bool everything)
_width = p._width;
_maxWidth = p._maxWidth;
_wordSpacing = p._wordSpacing;
+ _verticalAlign = p._verticalAlign;
}
}
}
diff --git a/Source/HtmlRenderer/Core/Dom/CssLayoutEngine.cs b/Source/HtmlRenderer/Core/Dom/CssLayoutEngine.cs
index a24f9e708..bd123e878 100644
--- a/Source/HtmlRenderer/Core/Dom/CssLayoutEngine.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssLayoutEngine.cs
@@ -55,7 +55,7 @@ public static void MeasureImageSize(CssRectImage imageWord)
}
else
{
- imageWord.Width = hasImageTagHeight ? height.Number / 1.14f : 20;
+ imageWord.Width = hasImageTagHeight ? height.Number / 1.14 : 20.0;
}
var maxWidth = new CssLength(imageWord.OwnerBox.MaxWidth);
@@ -88,7 +88,7 @@ public static void MeasureImageSize(CssRectImage imageWord)
}
else
{
- imageWord.Height = imageWord.Width > 0 ? imageWord.Width * 1.14f : 22.8f;
+ imageWord.Height = imageWord.Width > 0 ? imageWord.Width * 1.14 : 22.8;
}
if (imageWord.Image != null)
@@ -181,8 +181,8 @@ public static void ApplyCellVerticalAlignment(RGraphics g, CssBox cell)
return;
double cellbot = cell.ClientBottom;
- double bottom = cell.GetMaximumBottom(cell, 0f);
- double dist = 0f;
+ double bottom = cell.GetMaximumBottom(cell, 0.0);
+ double dist = 0.0;
if (cell.VerticalAlign == CssConstants.Bottom)
{
@@ -542,10 +542,10 @@ private static void ApplyVerticalAlignment(RGraphics g, CssLineBox lineBox)
switch (box.VerticalAlign)
{
case CssConstants.Sub:
- lineBox.SetBaseLine(g, box, baseline + lineBox.Rectangles[box].Height * .5f);
+ lineBox.SetBaseLine(g, box, baseline + lineBox.Rectangles[box].Height * .5);
break;
case CssConstants.Super:
- lineBox.SetBaseLine(g, box, baseline - lineBox.Rectangles[box].Height * .2f);
+ lineBox.SetBaseLine(g, box, baseline - lineBox.Rectangles[box].Height * .2);
break;
case CssConstants.TextTop:
@@ -580,19 +580,19 @@ private static void ApplyJustifyAlignment(RGraphics g, CssLineBox lineBox)
if (lineBox.Equals(lineBox.OwnerBox.LineBoxes[lineBox.OwnerBox.LineBoxes.Count - 1]))
return;
- double indent = lineBox.Equals(lineBox.OwnerBox.LineBoxes[0]) ? lineBox.OwnerBox.ActualTextIndent : 0f;
- double textSum = 0f;
- double words = 0f;
+ double indent = lineBox.Equals(lineBox.OwnerBox.LineBoxes[0]) ? lineBox.OwnerBox.ActualTextIndent : 0.0;
+ double textSum = 0.0;
+ double words = 0.0;
double availWidth = lineBox.OwnerBox.ClientRectangle.Width - indent;
// Gather text sum
foreach (CssRect w in lineBox.Words)
{
textSum += w.Width;
- words += 1f;
+ words += 1.0;
}
- if (words <= 0f)
+ if (words <= 0.0)
return; //Avoid Zero division
double spacing = (availWidth - textSum) / words; //Spacing that will be used
double curx = lineBox.OwnerBox.ClientLeft + indent;
diff --git a/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs b/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs
index 79627161a..116a487d9 100644
--- a/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs
@@ -364,7 +364,7 @@ private double CalculateCountAndWidth()
///
private void DetermineMissingColumnWidths(double availCellSpace)
{
- double occupedSpace = 0f;
+ double occupedSpace = 0.0;
if (_widthSpecified) //If a width was specified,
{
//Assign NaNs equally with space left after gathering not-NaNs
@@ -482,7 +482,7 @@ private void EnforceMaximumSize()
while (!CanReduceWidth(curCol))
curCol++;
- _columnWidths[curCol] -= 1f;
+ _columnWidths[curCol] -= 1.0;
curCol++;
@@ -514,7 +514,7 @@ private void EnforceMaximumSize()
for (int a = 0; a < 15 && maxWidth < widthSum - 0.1; a++) // limit iteration so bug won't create infinite loop
{
int nonMaxedColumns = 0;
- double largeWidth = 0f, secLargeWidth = 0f;
+ double largeWidth = 0.0, secLargeWidth = 0.0;
for (int i = 0; i < _columnWidths.Length; i++)
{
if (_columnWidths[i] > largeWidth + 0.1)
@@ -610,7 +610,8 @@ private void LayoutCells(RGraphics g)
double starty = Math.Max(_tableBox.ClientTop + GetVerticalSpacing(), 0);
double cury = starty;
double maxRight = startx;
- double maxBottom = 0f;
+ double maxBottom = 0.0;
+ double maxHeaderBottom = 0.0;
int currentrow = 0;
// change start X by if the table should align to center or right
@@ -634,6 +635,7 @@ private void LayoutCells(RGraphics g)
for (int j = 0; j < row.Boxes.Count; j++)
{
CssBox cell = row.Boxes[j];
+ var isheader = (cell.HtmlTag.Name == "th");
if (curCol >= _columnWidths.Length)
break;
@@ -641,7 +643,7 @@ private void LayoutCells(RGraphics g)
var columnIndex = GetCellRealColumnIndex(row, cell);
double width = GetCellWidth(columnIndex, cell);
cell.Location = new RPoint(curx, cury);
- cell.Size = new RSize(width, 0f);
+ cell.Size = new RSize(width, 0.0);
cell.PerformLayout(g); //That will automatically set the bottom of the cell
//Alter max bottom only if row is cell's row + cell's rowspan - 1
@@ -660,6 +662,11 @@ private void LayoutCells(RGraphics g)
maxRight = Math.Max(maxRight, cell.ActualRight);
curCol++;
curx = cell.ActualRight + GetHorizontalSpacing();
+
+ if (isheader)
+ {
+ maxHeaderBottom = maxBottom;
+ }
}
foreach (CssBox cell in row.Boxes)
@@ -708,6 +715,11 @@ private void LayoutCells(RGraphics g)
maxRight = Math.Max(maxRight, _tableBox.Location.X + _tableBox.ActualWidth);
_tableBox.ActualRight = maxRight + GetHorizontalSpacing() + _tableBox.ActualBorderRightWidth;
_tableBox.ActualBottom = Math.Max(maxBottom, starty) + GetVerticalSpacing() + _tableBox.ActualBorderBottomWidth;
+
+#warning EFR : Added headerbox calculation
+ _headerBox.Location = _tableBox.Location;
+ _headerBox.ActualRight = maxRight + GetHorizontalSpacing() + _headerBox.ActualBorderRightWidth;
+ _headerBox.ActualBottom = Math.Max(maxHeaderBottom, starty) + GetVerticalSpacing() + _headerBox.ActualBorderBottomWidth;
}
///
@@ -715,7 +727,7 @@ private void LayoutCells(RGraphics g)
///
private double GetSpannedMinWidth(CssBox row, CssBox cell, int realcolindex, int colspan)
{
- double w = 0f;
+ double w = 0.0;
for (int i = realcolindex; i < row.Boxes.Count || i < realcolindex + colspan - 1; i++)
{
if (i < GetColumnMinWidths().Length)
@@ -753,7 +765,7 @@ private static int GetCellRealColumnIndex(CssBox row, CssBox cell)
private double GetCellWidth(int column, CssBox b)
{
double colspan = Convert.ToSingle(GetColSpan(b));
- double sum = 0f;
+ double sum = 0.0;
for (int i = column; i < column + colspan; i++)
{
@@ -894,7 +906,7 @@ private double GetMaxTableWidth()
}
else
{
- return 9999f;
+ return 9999.0;
}
}
@@ -954,7 +966,7 @@ private double GetAvailableCellWidth()
///
private double GetWidthSum()
{
- double f = 0f;
+ double f = 0.0;
foreach (double t in _columnWidths)
{
@@ -1015,7 +1027,7 @@ private double[] GetColumnMinWidths()
///
private double GetHorizontalSpacing()
{
- return _tableBox.BorderCollapse == CssConstants.Collapse ? -1f : _tableBox.ActualBorderSpacingHorizontal;
+ return _tableBox.BorderCollapse == CssConstants.Collapse ? -1.0 : _tableBox.ActualBorderSpacingHorizontal;
}
///
@@ -1023,7 +1035,7 @@ private double GetHorizontalSpacing()
///
private static double GetHorizontalSpacing(CssBox box)
{
- return box.BorderCollapse == CssConstants.Collapse ? -1f : box.ActualBorderSpacingHorizontal;
+ return box.BorderCollapse == CssConstants.Collapse ? -1.0 : box.ActualBorderSpacingHorizontal;
}
///
@@ -1031,7 +1043,7 @@ private static double GetHorizontalSpacing(CssBox box)
///
private double GetVerticalSpacing()
{
- return _tableBox.BorderCollapse == CssConstants.Collapse ? -1f : _tableBox.ActualBorderSpacingVertical;
+ return _tableBox.BorderCollapse == CssConstants.Collapse ? -1.0 : _tableBox.ActualBorderSpacingVertical;
}
#endregion
diff --git a/Source/HtmlRenderer/Core/Dom/CssLength.cs b/Source/HtmlRenderer/Core/Dom/CssLength.cs
index 6b7eebf20..3f66ce04f 100644
--- a/Source/HtmlRenderer/Core/Dom/CssLength.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssLength.cs
@@ -32,7 +32,7 @@ internal sealed class CssLength
public CssLength(string length)
{
_length = length;
- _number = 0f;
+ _number = 0.0;
_unit = CssUnit.None;
_isPercentage = false;
diff --git a/Source/HtmlRenderer/Core/Dom/CssLineBox.cs b/Source/HtmlRenderer/Core/Dom/CssLineBox.cs
index dd2db8925..fb52f9a50 100644
--- a/Source/HtmlRenderer/Core/Dom/CssLineBox.cs
+++ b/Source/HtmlRenderer/Core/Dom/CssLineBox.cs
@@ -219,7 +219,7 @@ internal void SetBaseLine(RGraphics g, CssBox b, double baseline)
RRect r = Rectangles[b];
//Save top of words related to the top of rectangle
- double gap = 0f;
+ double gap = 0.0;
if (ws.Count > 0)
{
diff --git a/Source/HtmlRenderer/Core/Handlers/BackgroundImageDrawHandler.cs b/Source/HtmlRenderer/Core/Handlers/BackgroundImageDrawHandler.cs
index 275f23320..301eedc7d 100644
--- a/Source/HtmlRenderer/Core/Handlers/BackgroundImageDrawHandler.cs
+++ b/Source/HtmlRenderer/Core/Handlers/BackgroundImageDrawHandler.cs
@@ -85,7 +85,7 @@ private static RPoint GetLocation(string backgroundPosition, RRect rectangle, RS
double left = rectangle.Left;
if (backgroundPosition.IndexOf("left", StringComparison.OrdinalIgnoreCase) > -1)
{
- left = (rectangle.Left + .5f);
+ left = (rectangle.Left + .5);
}
else if (backgroundPosition.IndexOf("right", StringComparison.OrdinalIgnoreCase) > -1)
{
@@ -93,7 +93,7 @@ private static RPoint GetLocation(string backgroundPosition, RRect rectangle, RS
}
else if (backgroundPosition.IndexOf("0", StringComparison.OrdinalIgnoreCase) < 0)
{
- left = (rectangle.Left + (rectangle.Width - imgSize.Width) / 2 + .5f);
+ left = (rectangle.Left + (rectangle.Width - imgSize.Width) / 2 + .5);
}
double top = rectangle.Top;
@@ -107,7 +107,7 @@ private static RPoint GetLocation(string backgroundPosition, RRect rectangle, RS
}
else if (backgroundPosition.IndexOf("0", StringComparison.OrdinalIgnoreCase) < 0)
{
- top = (rectangle.Top + (rectangle.Height - imgSize.Height) / 2 + .5f);
+ top = (rectangle.Top + (rectangle.Height - imgSize.Height) / 2 + .5);
}
return new RPoint(left, top);
diff --git a/Source/HtmlRenderer/Core/Handlers/SelectionHandler.cs b/Source/HtmlRenderer/Core/Handlers/SelectionHandler.cs
index 9913a9c5d..82155ac3a 100644
--- a/Source/HtmlRenderer/Core/Handlers/SelectionHandler.cs
+++ b/Source/HtmlRenderer/Core/Handlers/SelectionHandler.cs
@@ -641,7 +641,7 @@ private void CalculateWordCharIndexAndOffset(RControl control, CssRect word, RPo
private static void CalculateWordCharIndexAndOffset(RControl control, CssRect word, RPoint loc, bool inclusive, out int selectionIndex, out double selectionOffset)
{
selectionIndex = 0;
- selectionOffset = 0f;
+ selectionOffset = 0.0;
var offset = loc.X - word.Left;
if (word.Text == null)
{
@@ -660,7 +660,7 @@ private static void CalculateWordCharIndexAndOffset(RControl control, CssRect wo
// calculate partial word selection
int charFit;
double charFitWidth;
- var maxWidth = offset + (inclusive ? 0 : 1.5f * word.LeftGlyphPadding);
+ var maxWidth = offset + (inclusive ? 0 : 1.5 * word.LeftGlyphPadding);
control.MeasureString(word.Text, word.OwnerBox.ActualFont, maxWidth, out charFit, out charFitWidth);
selectionIndex = charFit;
diff --git a/Source/HtmlRenderer/Core/Parse/CssParser.cs b/Source/HtmlRenderer/Core/Parse/CssParser.cs
index 045cbb687..cb6ef8975 100644
--- a/Source/HtmlRenderer/Core/Parse/CssParser.cs
+++ b/Source/HtmlRenderer/Core/Parse/CssParser.cs
@@ -625,9 +625,10 @@ private static string ParseImageProperty(string propValue)
private string ParseFontFamilyProperty(string propValue)
{
int start = 0;
- while (start > -1 && start < propValue.Length)
+
+ while (start < propValue.Length)
{
- while (char.IsWhiteSpace(propValue[start]) || propValue[start] == ',' || propValue[start] == '\'' || propValue[start] == '"')
+ while (start < propValue.Length && (char.IsWhiteSpace(propValue[start]) || propValue[start] == ',' || propValue[start] == '\'' || propValue[start] == '"'))
start++;
var end = propValue.IndexOf(',', start);
if (end < 0)
@@ -639,9 +640,7 @@ private string ParseFontFamilyProperty(string propValue)
var font = propValue.Substring(start, adjEnd - start + 1);
if (_adapter.IsFontExists(font))
- {
return font;
- }
start = end;
}
diff --git a/Source/HtmlRenderer/Core/Parse/CssValueParser.cs b/Source/HtmlRenderer/Core/Parse/CssValueParser.cs
index b7c721b28..d6291dd79 100644
--- a/Source/HtmlRenderer/Core/Parse/CssValueParser.cs
+++ b/Source/HtmlRenderer/Core/Parse/CssValueParser.cs
@@ -123,7 +123,7 @@ public static double ParseNumber(string number, double hundredPercent)
{
if (string.IsNullOrEmpty(number))
{
- return 0f;
+ return 0.0;
}
string toParse = number;
@@ -135,12 +135,12 @@ public static double ParseNumber(string number, double hundredPercent)
if (!double.TryParse(toParse, NumberStyles.Number, NumberFormatInfo.InvariantInfo, out result))
{
- return 0f;
+ return 0.0;
}
if (isPercent)
{
- result = (result / 100f) * hundredPercent;
+ result = (result / 100.0) * hundredPercent;
}
return result;
@@ -212,31 +212,24 @@ public static double ParseLength(string length, double hundredPercent, double em
factor = emFactor / 2;
break;
case CssConstants.Px:
- factor = fontAdjust ? 72f / 96f : 1f; //TODO:a check support for hi dpi
+ factor = fontAdjust ? 72.0 / 96.0 : 1.0; //TODO:a check support for hi dpi
break;
case CssConstants.Mm:
- factor = 3.779527559f; //3 pixels per millimeter
+ factor = 3.779527559; //3 pixels per millimeter
break;
case CssConstants.Cm:
- factor = 37.795275591f; //37 pixels per centimeter
+ factor = 37.795275591; //37 pixels per centimeter
break;
case CssConstants.In:
- factor = 96f; //96 pixels per inch
+ factor = 96.0; //96 pixels per inch
break;
case CssConstants.Pt:
- factor = 96f / 72f; // 1 point = 1/72 of inch
-
- if (returnPoints)
- {
- return ParseNumber(number, hundredPercent);
- }
-
- break;
+ return ParseNumber(number, hundredPercent) / (returnPoints ? 1.0 : (72.0 / 96.0));
case CssConstants.Pc:
- factor = 16f; // 1 pica = 12 points
+ factor = 16.0; // 1 pica = 12 points
break;
default:
- factor = 0f;
+ factor = 0.0;
break;
}
@@ -346,11 +339,11 @@ public static double GetActualBorderWidth(string borderValue, CssBoxProperties b
switch (borderValue)
{
case CssConstants.Thin:
- return 1f;
+ return 1.0;
case CssConstants.Medium:
- return 2f;
+ return 2.0;
case CssConstants.Thick:
- return 4f;
+ return 4.0;
default:
return Math.Abs(ParseLength(borderValue, 1, b));
}
diff --git a/Source/HtmlRenderer/Core/Utils/CssConstants.cs b/Source/HtmlRenderer/Core/Utils/CssConstants.cs
index 655849256..34e1642e0 100644
--- a/Source/HtmlRenderer/Core/Utils/CssConstants.cs
+++ b/Source/HtmlRenderer/Core/Utils/CssConstants.cs
@@ -159,7 +159,7 @@ internal static class CssConstants
///
/// Default font size in points. Change this value to modify the default font size.
///
- public const double FontSize = 11f;
+ public const double FontSize = 11.0;
///
/// Default font used for the generic 'serif' family
diff --git a/Source/HtmlRenderer/Core/Utils/RenderUtils.cs b/Source/HtmlRenderer/Core/Utils/RenderUtils.cs
index 2726b5fb2..e314ef42b 100644
--- a/Source/HtmlRenderer/Core/Utils/RenderUtils.cs
+++ b/Source/HtmlRenderer/Core/Utils/RenderUtils.cs
@@ -116,22 +116,22 @@ public static RGraphicsPath GetRoundRect(RGraphics g, RRect rect, double nwRadiu
path.LineTo(rect.Right - neRadius, rect.Y);
- if (neRadius > 0f)
+ if (neRadius > 0.0)
path.ArcTo(rect.Right, rect.Top + neRadius, neRadius, RGraphicsPath.Corner.TopRight);
path.LineTo(rect.Right, rect.Bottom - seRadius);
- if (seRadius > 0f)
+ if (seRadius > 0.0)
path.ArcTo(rect.Right - seRadius, rect.Bottom, seRadius, RGraphicsPath.Corner.BottomRight);
path.LineTo(rect.Left + swRadius, rect.Bottom);
- if (swRadius > 0f)
+ if (swRadius > 0.0)
path.ArcTo(rect.Left, rect.Bottom - swRadius, swRadius, RGraphicsPath.Corner.BottomLeft);
path.LineTo(rect.Left, rect.Top + nwRadius);
- if (nwRadius > 0f)
+ if (nwRadius > 0.0)
path.ArcTo(rect.Left + nwRadius, rect.Top, nwRadius, RGraphicsPath.Corner.TopLeft);
return path;