OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 } | 895 } |
896 | 896 |
897 return fragment.release(); | 897 return fragment.release(); |
898 } | 898 } |
899 | 899 |
900 String createFullMarkup(const Node* node) | 900 String createFullMarkup(const Node* node) |
901 { | 901 { |
902 if (!node) | 902 if (!node) |
903 return String(); | 903 return String(); |
904 | 904 |
905 Document* document = node->document(); | 905 Frame* frame = node->document()->frame(); |
906 if (!document) | |
907 return String(); | |
908 | |
909 Frame* frame = document->frame(); | |
910 if (!frame) | 906 if (!frame) |
911 return String(); | 907 return String(); |
912 | 908 |
913 // FIXME: This is never "for interchange". Is that right? | 909 // FIXME: This is never "for interchange". Is that right? |
914 String markupString = createMarkup(node, IncludeNode, 0); | 910 String markupString = createMarkup(node, IncludeNode, 0); |
915 Node::NodeType nodeType = node->nodeType(); | 911 Node::NodeType nodeType = node->nodeType(); |
916 if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE) | 912 if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE) |
917 markupString = frame->documentTypeString() + markupString; | 913 markupString = frame->documentTypeString() + markupString; |
918 | 914 |
919 return markupString; | 915 return markupString; |
920 } | 916 } |
921 | 917 |
922 String createFullMarkup(const Range* range) | 918 String createFullMarkup(const Range* range) |
923 { | 919 { |
924 if (!range) | 920 if (!range) |
925 return String(); | 921 return String(); |
926 | 922 |
927 Node* node = range->startContainer(); | 923 Node* node = range->startContainer(); |
928 if (!node) | 924 if (!node) |
929 return String(); | 925 return String(); |
930 | 926 |
931 Document* document = node->document(); | 927 Frame* frame = node->document()->frame(); |
932 if (!document) | |
933 return String(); | |
934 | |
935 Frame* frame = document->frame(); | |
936 if (!frame) | 928 if (!frame) |
937 return String(); | 929 return String(); |
938 | 930 |
939 // FIXME: This is always "for interchange". Is that right? See the previous
method. | 931 // FIXME: This is always "for interchange". Is that right? See the previous
method. |
940 return frame->documentTypeString() + createMarkup(range, 0, AnnotateForInter
change); | 932 return frame->documentTypeString() + createMarkup(range, 0, AnnotateForInter
change); |
941 } | 933 } |
942 | 934 |
943 String urlToMarkup(const KURL& url, const String& title) | 935 String urlToMarkup(const KURL& url, const String& title) |
944 { | 936 { |
945 StringBuilder markup; | 937 StringBuilder markup; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 if (containerNode->hasOneChild()) { | 1072 if (containerNode->hasOneChild()) { |
1081 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), es); | 1073 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), es); |
1082 return; | 1074 return; |
1083 } | 1075 } |
1084 | 1076 |
1085 containerNode->removeChildren(); | 1077 containerNode->removeChildren(); |
1086 containerNode->appendChild(textNode.release(), es); | 1078 containerNode->appendChild(textNode.release(), es); |
1087 } | 1079 } |
1088 | 1080 |
1089 } | 1081 } |
OLD | NEW |