From 369c2b0bdc88c9b86408a1e954098792736fd020 Mon Sep 17 00:00:00 2001
From: Simon Stevenson
Date: Tue, 12 May 2015 17:46:37 +1000
Subject: [PATCH 01/42] Fix for the last attribute without a value crashing the
parser
---
Source/HtmlRenderer/Core/Parse/HtmlParser.cs | 26 +++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/Source/HtmlRenderer/Core/Parse/HtmlParser.cs b/Source/HtmlRenderer/Core/Parse/HtmlParser.cs
index 286dee89c..f246fda82 100644
--- a/Source/HtmlRenderer/Core/Parse/HtmlParser.cs
+++ b/Source/HtmlRenderer/Core/Parse/HtmlParser.cs
@@ -222,27 +222,31 @@ private static void ExtractAttributes(string source, int idx, int length, out Di
if (startIdx < idx + length)
{
var key = source.Substring(startIdx, endIdx - startIdx);
+ var value = "";
startIdx = endIdx + 1;
while (startIdx < idx + length && (char.IsWhiteSpace(source, startIdx) || source[startIdx] == '='))
startIdx++;
bool hasPChar = false;
- char pChar = source[startIdx];
- if (pChar == '"' || pChar == '\'')
+ if (startIdx < idx + length)
{
- hasPChar = true;
- startIdx++;
- }
+ char pChar = source[startIdx];
+ if (pChar == '"' || pChar == '\'')
+ {
+ hasPChar = true;
+ startIdx++;
+ }
- endIdx = startIdx + (hasPChar ? 0 : 1);
- while (endIdx < idx + length && (hasPChar ? source[endIdx] != pChar : !char.IsWhiteSpace(source, endIdx)))
- endIdx++;
+ endIdx = startIdx + (hasPChar ? 0 : 1);
+ while (endIdx < idx + length && (hasPChar ? source[endIdx] != pChar : !char.IsWhiteSpace(source, endIdx)))
+ endIdx++;
- var value = source.Substring(startIdx, endIdx - startIdx);
- value = HtmlUtils.DecodeHtml(value);
+ value = source.Substring(startIdx, endIdx - startIdx);
+ value = HtmlUtils.DecodeHtml(value);
+ }
- if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
+ if (!string.IsNullOrEmpty(key) && (value != null))
{
if (attributes == null)
attributes = new Dictionary(StringComparer.InvariantCultureIgnoreCase);
From 530e9a05f4caf2c3958634170b4ea80d0de05a47 Mon Sep 17 00:00:00 2001
From: Andrey Ushakov
Date: Tue, 26 Apr 2016 13:57:23 +0300
Subject: [PATCH 02/42] Support base64 images in css content property
---
Source/Demo/Common/HtmlRenderer.Demo.Common.csproj | 3 +++
.../Common/TestSamples/32.Image in css content.htm | 14 ++++++++++++++
Source/HtmlRenderer/Core/Dom/CssBoxImage.cs | 8 ++++++--
Source/HtmlRenderer/Core/Dom/CssBoxProperties.cs | 10 ++++++++--
Source/HtmlRenderer/Core/Parse/CssParser.cs | 14 ++++++++++++--
Source/HtmlRenderer/Core/Utils/CssUtils.cs | 5 +++++
Source/HtmlRenderer/Core/Utils/HtmlConstants.cs | 2 +-
7 files changed, 49 insertions(+), 7 deletions(-)
create mode 100644 Source/Demo/Common/TestSamples/32.Image in css content.htm
diff --git a/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj b/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj
index a8ffe8490..9e964a55e 100644
--- a/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj
+++ b/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj
@@ -155,6 +155,9 @@
+
+
+
- foinobpjg
+ foinobpjg
@@ -62,8 +62,8 @@
@@ -71,9 +71,9 @@
&ppbg;
@@ -140,7 +140,7 @@
|
- fcb: j onq'p eoapl jmin leo halnbcmam ei cfri... m´h qnlpll lnha ohhrrjbcf jghl
+ fcb: j onq'p eoapl jmin leo halnbcmam ei cfri... m´h qnlpll lnha ohhrrjbcf jghl
bqcrgpk lb abp qkqo gralcp kfeildpd, dbjbj ril eppg n hfcbqd gqj fnjd &gpnp;egoppa&foaq;
fn &ncon;ccrb hm rjelnn&jgkl; qhlj kpkfoe qead odr obepl ij gfk dekfm, gmo fifdf
kle cnnj bpjon fgn frbcf'e haerd qfgimmkn le gfol nifmojh rrjghcqa dkac (koen hpccjmi,
@@ -149,7 +149,7 @@ |
@@ -176,7 +176,7 @@
@@ -200,12 +200,12 @@
@@ -225,7 +225,7 @@
@@ -247,7 +247,7 @@
@@ -269,7 +269,7 @@
@@ -291,7 +291,7 @@
@@ -387,7 +387,7 @@
@@ -417,7 +417,7 @@
@@ -438,7 +438,7 @@
@@ -472,7 +472,7 @@
@@ -495,7 +495,7 @@
@@ -517,7 +517,7 @@
@@ -540,7 +540,7 @@ giedc heaarh'e
+ href='https://www.google.com'>giedc heaarh'e
dqcpcipck icdbp pk nbbk riel)
&jbhp;
@@ -573,7 +573,7 @@ fekjk rrekjm'e
+ href='https://www.google.com'>fekjk rrekjm'e
dcolmagp abgep gb alhk rddm)
&gnpe;
hfapi: ppo kbl'd pefl dqgmdqrkdq nb rhhppnr ka {dpgrj irae}.
@@ -602,7 +602,7 @@ aqckk idkjob'o
+ href='https://www.google.com'>aqckk idkjob'o
pmqapakp migeq pcrg)
&mpib;
@@ -631,7 +631,7 @@
@@ -655,7 +655,7 @@ eefgj rhnmcr
+ href='https://www.google.com'>eefgj rhnmcr
&crmk;
@@ -671,7 +671,7 @@
&ignd;
@@ -702,7 +702,7 @@ dgobg hrhlrm
+ href='https://www.google.com'>dgobg hrhlrm
&rhfd;
@@ -733,7 +733,7 @@
qpefa nflrrd
+ href='https://www.google.com'>qpefa nflrrd
&ikkb;
cpage: mornan.
@@ -785,10 +785,10 @@
- obm: r´c&pjfi; pfe &lgrl;hcag enkdefl jkfalcch in iqfardi&mccr; lc clrdqbj &jmpe;amcolbiq
+ obm: r´c&pjfi; pfe &lgrl;hcag enkdefl jkfalcch in iqfardi&mccr; lc clrdqbj &jmpe;amcolbiq
jp rdngfkc&jccl; (pidh &mrdg;qeoba&aeal; ablac eche). plj hrjmkcd rhrcfkkl ccmfa
jjjbikmea...
+ data-containertype="-1" data-objectid="3512" data-objecttype="3" href='https://www.google.com'>
rhbjp jeegip
&abdb;
@@ -826,7 +826,7 @@ cronf dhgobi
+ href='https://www.google.com'>cronf dhgobi
&mggq;
@@ -1066,7 +1066,7 @@
@@ -1087,7 +1087,7 @@
@@ -1132,7 +1132,7 @@
@@ -1154,7 +1154,7 @@
@@ -1175,7 +1175,7 @@
@@ -1196,7 +1196,7 @@
@@ -1218,7 +1218,7 @@
@@ -1284,7 +1284,7 @@
@@ -1306,7 +1306,7 @@
@@ -1336,7 +1336,7 @@
@@ -1357,7 +1357,7 @@ gdl: hlioq fjcflcph,
+ href='https://www.google.com'>hlioq fjcflcph,
f ahlbk ro cadqohcid qq agdal mfimik pnrk kja kf od pfkeq cq h lcnepa croq nb efkciqd:
- 2 okilkcojphgo: djfpicickhje ljmqjni
@@ -1376,7 +1376,7 @@
farohbqrgo
+ href='https://www.google.com'>farohbqrgo
@@ -1399,7 +1399,7 @@
poihpkqmjj
+ href='https://www.google.com'>poihpkqmjj
@@ -1420,7 +1420,7 @@
@@ -1440,7 +1440,7 @@
@@ -1460,7 +1460,7 @@
@@ -1484,7 +1484,7 @@
@@ -1505,7 +1505,7 @@
@@ -1526,7 +1526,7 @@
@@ -1547,7 +1547,7 @@
@@ -1568,7 +1568,7 @@
@@ -1589,7 +1589,7 @@
@@ -1610,7 +1610,7 @@
@@ -1631,7 +1631,7 @@
@@ -1652,7 +1652,7 @@
@@ -1828,7 +1828,7 @@
+ data-objectid="3512" data-objecttype="3" href='https://www.google.com'>
abnaf ajllna
@@ -1854,7 +1854,7 @@ gekjn ofkcmr
+ href='https://www.google.com'>gekjn ofkcmr
|
|
@@ -1899,7 +1899,7 @@
nrg: {0} pkmcf'j bnpo apjcnfcbfg ip akmr dmgicpk jj ind faleekdg ccaeo (bhkqr jbhfgh)
+ href='https://www.google.com'>bhkqr jbhfgh)
|
|
@@ -1944,7 +1944,7 @@
@@ -1965,7 +1965,7 @@
@@ -1987,7 +1987,7 @@
@@ -2029,7 +2029,7 @@
@@ -2050,7 +2050,7 @@
@@ -2071,7 +2071,7 @@
@@ -2093,7 +2093,7 @@
+ data-objectid="3512" data-objecttype="3" href='https://www.google.com'>
qfplf drmjhc, eei olh ldfjb qq n hmaomb eijbocg (nkn apieq)
&kdgl;
@@ -2101,7 +2101,7 @@
@@ -2122,7 +2122,7 @@
@@ -2143,7 +2143,7 @@
@@ -2165,7 +2165,7 @@
@@ -2207,7 +2207,7 @@
@@ -2228,7 +2228,7 @@
@@ -2249,7 +2249,7 @@
nal: &jldk;mdnmq qhk ig gpmmmhe nkqh ree gech rfobr. eqmm le bcbaob&hfda; (khobe dmqjgm),
+ href='https://www.google.com'>khobe dmqjgm),
orkc, jep'h nrn liio fridrq r ggq aan? beode jfci peok qhapof lipm ighnok deiec
fi dkgrclo bdghajgj.
@@ -2447,7 +2447,7 @@
+ data-objectid="3512" data-objecttype="3" href='https://www.google.com'>
roloc aeemag, mi cqr kdcr &oapr;ghp cmj mjln qlf rarl kr flrff eeq phciqr
mhmcbjd foandfmlcd gebj fhckphko?&bjea; mk jfpjaoa pq kc r kendoep? h'h akjd bkinjiclb
bpgo &deji;jki qpg bpna ded jnff qd jcgbr? fjdp prakprj rbfe eg pohr&gpkb;. bieaa,
@@ -2585,7 +2585,7 @@
@@ -2707,13 +2707,13 @@
@@ -2758,7 +2758,7 @@
@@ -3054,20 +3054,20 @@
|
- pngfmr o bba dahbkcro ql qaralkcqojci ch addkifq mie dcobgb 2.1 aa
- jjjpo, gm bp
+ jjjpo, gm bp qejpnprah
|
|
- qhfkmejmp iobknjbqlqdg pp hiahqhh epb rclnqo
2.1 ff ciden gjaooda: pabjq
|
diff --git a/Source/Demo/Common/Resources/Tooltip.html b/Source/Demo/Common/Resources/Tooltip.html
index 85892877a..1c00962e2 100644
--- a/Source/Demo/Common/Resources/Tooltip.html
+++ b/Source/Demo/Common/Resources/Tooltip.html
@@ -14,5 +14,5 @@
This is an
HtmlToolTip and it's very
COOL!!!
- You can even click on the
links!
+ You can even click on the
links!
\ No newline at end of file
diff --git a/Source/Demo/Common/Samples/00.Intro.htm b/Source/Demo/Common/Samples/00.Intro.htm
index ae8a64361..18c44f869 100644
--- a/Source/Demo/Common/Samples/00.Intro.htm
+++ b/Source/Demo/Common/Samples/00.Intro.htm
@@ -104,14 +104,11 @@
2012 - Arthur Teplitzki
- http://TheArtOfDev.com
+ https://TheArtOfDev.com
2009 - Jose Manuel Menendez Poo
-
- www.menendezpoo.com
-