OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "core/editing/MarkupAccumulator.h" | 48 #include "core/editing/MarkupAccumulator.h" |
49 #include "core/fetch/FontResource.h" | 49 #include "core/fetch/FontResource.h" |
50 #include "core/fetch/ImageResource.h" | 50 #include "core/fetch/ImageResource.h" |
51 #include "core/frame/Frame.h" | 51 #include "core/frame/Frame.h" |
52 #include "core/html/HTMLFrameOwnerElement.h" | 52 #include "core/html/HTMLFrameOwnerElement.h" |
53 #include "core/html/HTMLImageElement.h" | 53 #include "core/html/HTMLImageElement.h" |
54 #include "core/html/HTMLInputElement.h" | 54 #include "core/html/HTMLInputElement.h" |
55 #include "core/html/HTMLLinkElement.h" | 55 #include "core/html/HTMLLinkElement.h" |
56 #include "core/html/HTMLStyleElement.h" | 56 #include "core/html/HTMLStyleElement.h" |
57 #include "core/html/ImageDocument.h" | 57 #include "core/html/ImageDocument.h" |
58 #include "core/html/parser/HTMLParserIdioms.h" | 58 #include "core/html/parser/HTMLMetaCharsetParser.h" |
59 #include "core/page/Page.h" | 59 #include "core/page/Page.h" |
60 #include "core/rendering/RenderImage.h" | 60 #include "core/rendering/RenderImage.h" |
61 #include "core/rendering/style/StyleFetchedImage.h" | 61 #include "core/rendering/style/StyleFetchedImage.h" |
62 #include "core/rendering/style/StyleImage.h" | 62 #include "core/rendering/style/StyleImage.h" |
63 #include "platform/SerializedResource.h" | 63 #include "platform/SerializedResource.h" |
64 #include "platform/graphics/Image.h" | 64 #include "platform/graphics/Image.h" |
65 #include "wtf/text/CString.h" | 65 #include "wtf/text/CString.h" |
66 #include "wtf/text/StringBuilder.h" | 66 #include "wtf/text/StringBuilder.h" |
67 #include "wtf/text/TextEncoding.h" | 67 #include "wtf/text/TextEncoding.h" |
68 #include "wtf/text/WTFString.h" | 68 #include "wtf/text/WTFString.h" |
69 | 69 |
70 namespace WebCore { | 70 namespace WebCore { |
71 | 71 |
72 static bool isCharsetSpecifyingNode(Node* node) | 72 static bool isCharsetSpecifyingNode(Node* node) |
73 { | 73 { |
74 if (!node->isHTMLElement()) | 74 if (!node->isHTMLElement()) |
75 return false; | 75 return false; |
76 | 76 |
77 HTMLElement* element = toHTMLElement(node); | 77 HTMLElement* element = toHTMLElement(node); |
78 if (!element->hasTagName(HTMLNames::metaTag)) | 78 if (!element->hasTagName(HTMLNames::metaTag)) |
79 return false; | 79 return false; |
80 HTMLAttributeList attributes; | 80 HTMLMetaCharsetParser::AttributeList attributes; |
81 if (element->hasAttributes()) { | 81 if (element->hasAttributes()) { |
82 for (unsigned i = 0; i < element->attributeCount(); ++i) { | 82 for (unsigned i = 0; i < element->attributeCount(); ++i) { |
83 const Attribute* attribute = element->attributeItem(i); | 83 const Attribute* attribute = element->attributeItem(i); |
84 // FIXME: We should deal appropriately with the attribute if they ha
ve a namespace. | 84 // FIXME: We should deal appropriately with the attribute if they ha
ve a namespace. |
85 attributes.append(std::make_pair(attribute->name().localName(), attr
ibute->value().string())); | 85 attributes.append(std::make_pair(attribute->name().toString(), attri
bute->value().string())); |
86 } | 86 } |
87 } | 87 } |
88 WTF::TextEncoding textEncoding = encodingFromMetaAttributes(attributes); | 88 WTF::TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttr
ibutes(attributes); |
89 return textEncoding.isValid(); | 89 return textEncoding.isValid(); |
90 } | 90 } |
91 | 91 |
92 static bool shouldIgnoreElement(Element* element) | 92 static bool shouldIgnoreElement(Element* element) |
93 { | 93 { |
94 return element->hasTagName(HTMLNames::scriptTag) || element->hasTagName(HTML
Names::noscriptTag) || isCharsetSpecifyingNode(element); | 94 return element->hasTagName(HTMLNames::scriptTag) || element->hasTagName(HTML
Names::noscriptTag) || isCharsetSpecifyingNode(element); |
95 } | 95 } |
96 | 96 |
97 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme
nt& frameOwner) | 97 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme
nt& frameOwner) |
98 { | 98 { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if (iter != m_blankFrameURLs.end()) | 471 if (iter != m_blankFrameURLs.end()) |
472 return iter->value; | 472 return iter->value; |
473 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); | 473 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); |
474 KURL fakeURL(ParsedURLString, url); | 474 KURL fakeURL(ParsedURLString, url); |
475 m_blankFrameURLs.add(frame, fakeURL); | 475 m_blankFrameURLs.add(frame, fakeURL); |
476 | 476 |
477 return fakeURL; | 477 return fakeURL; |
478 } | 478 } |
479 | 479 |
480 } | 480 } |
OLD | NEW |