Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: Source/core/page/PageSerializer.cpp

Issue 118573002: Revert of Moved text decoding to the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_step25
Patch Set: Compile fix Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/page/EventSource.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/page/EventSource.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698