Fix #124907 by simply backporting the same fix as for the XML parser

* HTMLparser.c: Fix #124907 by simply backporting the same
  fix as for the XML parser
* result/HTML/doc3.htm.err: change to ID detecting modified one
  test result.
Daniel
diff --git a/HTMLparser.c b/HTMLparser.c
index ba12ecc..5e9b2c4 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -231,9 +231,13 @@
 
 #define CUR_PTR ctxt->input->cur
 
-#define SHRINK  xmlParserInputShrink(ctxt->input)
+#define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
+		   (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
+	xmlParserInputShrink(ctxt->input)
 
-#define GROW  xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
+#define GROW if ((ctxt->progressive == 0) &&				\
+		 (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK))	\
+	xmlParserInputGrow(ctxt->input, INPUT_CHUNK)
 
 #define CURRENT ((int) (*ctxt->input->cur))