1 /* 2 * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #include "config.h" 27 #include "HTMLParserErrorCodes.h" 28 29 namespace WebCore { 30 htmlParserErrorMessageTemplate(HTMLParserErrorCode errorCode)31 const char* htmlParserErrorMessageTemplate(HTMLParserErrorCode errorCode) 32 { 33 static const char* const errors[] = { 34 "%tag1 is not allowed inside %tag2. Moving %tag1 into the nearest enclosing <table>.", 35 "<head> must be a child of <html>. Content ignored.", 36 "%tag1 is not allowed inside %tag2. Moving %tag1 into the <head>.", 37 "Extra %tag1 encountered. Migrating attributes back to the original %tag1 element and ignoring the tag.", 38 "<area> is not allowed inside %tag1. Moving the <area> into the nearest enclosing <map>.", 39 "%tag1 is not allowed inside %tag2. Content ignored.", 40 "%tag1 is not allowed in a <frameset> page. Content ignored.", 41 "%tag1 is not allowed inside %tag2. Closing %tag2 and trying the insertion again.", 42 "%tag1 is not allowed inside <caption>. Closing the <caption> and trying the insertion again.", 43 "<table> is not allowed inside %tag1. Closing the current <table> and inserting the new <table> as a sibling.", 44 "%tag1 is not allowed inside %tag2. Inserting %tag1 before the <table> instead.", 45 "%tag1 misplaced in <table>. Creating %tag2 and putting %tag1 inside it.", 46 "</br> encountered. Converting </br> into <br>.", 47 "XML self-closing tag syntax used on %tag1. The tag will not be closed.", 48 "Unmatched </p> encountered. Converting </p> into <p></p>.", 49 "Unmatched %tag1 encountered. Ignoring tag.", 50 "%tag1 misnested or not properly closed. Cloning %tag1 in order to preserve the styles applied by it.", 51 "<form> cannot act as a container inside %tag1 without disrupting the table. The children of the <form> will be placed inside the %tag1 instead.", 52 "XML self-closing tag syntax used on <script>. The tag will be closed by WebKit, but not all browsers do this. Change to <script></script> instead for best cross-browser compatibility." 53 }; 54 55 if (errorCode >= MisplacedTablePartError && errorCode <= IncorrectXMLCloseScriptWarning) 56 return errors[errorCode]; 57 return 0; 58 } 59 htmlParserDocumentWriteMessage()60 const char* htmlParserDocumentWriteMessage() 61 { 62 return "[The HTML that caused this error was generated by a script.] "; 63 } 64 isWarning(HTMLParserErrorCode code)65 bool isWarning(HTMLParserErrorCode code) 66 { 67 return code >= IncorrectXMLCloseScriptWarning; 68 } 69 70 } 71