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

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

Issue 133273007: Revert "Moved text decoding to the parser thread" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "core/dom/Text.h" 47 #include "core/dom/Text.h"
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/parser/HTMLParserIdioms.h" 57 #include "core/html/parser/HTMLMetaCharsetParser.h"
58 #include "core/page/Page.h" 58 #include "core/page/Page.h"
59 #include "core/rendering/RenderImage.h" 59 #include "core/rendering/RenderImage.h"
60 #include "core/rendering/style/StyleFetchedImage.h" 60 #include "core/rendering/style/StyleFetchedImage.h"
61 #include "core/rendering/style/StyleImage.h" 61 #include "core/rendering/style/StyleImage.h"
62 #include "platform/SerializedResource.h" 62 #include "platform/SerializedResource.h"
63 #include "platform/graphics/Image.h" 63 #include "platform/graphics/Image.h"
64 #include "wtf/text/CString.h" 64 #include "wtf/text/CString.h"
65 #include "wtf/text/StringBuilder.h" 65 #include "wtf/text/StringBuilder.h"
66 #include "wtf/text/TextEncoding.h" 66 #include "wtf/text/TextEncoding.h"
67 #include "wtf/text/WTFString.h" 67 #include "wtf/text/WTFString.h"
68 68
69 namespace WebCore { 69 namespace WebCore {
70 70
71 static bool isCharsetSpecifyingNode(Node* node) 71 static bool isCharsetSpecifyingNode(Node* node)
72 { 72 {
73 if (!node->isHTMLElement()) 73 if (!node->isHTMLElement())
74 return false; 74 return false;
75 75
76 HTMLElement* element = toHTMLElement(node); 76 HTMLElement* element = toHTMLElement(node);
77 if (!element->hasTagName(HTMLNames::metaTag)) 77 if (!element->hasTagName(HTMLNames::metaTag))
78 return false; 78 return false;
79 HTMLAttributeList attributes; 79 HTMLMetaCharsetParser::AttributeList attributes;
80 if (element->hasAttributes()) { 80 if (element->hasAttributes()) {
81 for (unsigned i = 0; i < element->attributeCount(); ++i) { 81 for (unsigned i = 0; i < element->attributeCount(); ++i) {
82 const Attribute* attribute = element->attributeItem(i); 82 const Attribute* attribute = element->attributeItem(i);
83 // FIXME: We should deal appropriately with the attribute if they ha ve a namespace. 83 // FIXME: We should deal appropriately with the attribute if they ha ve a namespace.
84 attributes.append(std::make_pair(attribute->name().localName(), attr ibute->value().string())); 84 attributes.append(std::make_pair(attribute->name().toString(), attri bute->value().string()));
85 } 85 }
86 } 86 }
87 WTF::TextEncoding textEncoding = encodingFromMetaAttributes(attributes); 87 WTF::TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttr ibutes(attributes);
88 return textEncoding.isValid(); 88 return textEncoding.isValid();
89 } 89 }
90 90
91 static bool shouldIgnoreElement(Element* element) 91 static bool shouldIgnoreElement(Element* element)
92 { 92 {
93 return element->hasTagName(HTMLNames::scriptTag) || element->hasTagName(HTML Names::noscriptTag) || isCharsetSpecifyingNode(element); 93 return element->hasTagName(HTMLNames::scriptTag) || element->hasTagName(HTML Names::noscriptTag) || isCharsetSpecifyingNode(element);
94 } 94 }
95 95
96 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme nt& frameOwner) 96 static const QualifiedName& frameOwnerURLAttributeName(const HTMLFrameOwnerEleme nt& frameOwner)
97 { 97 {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (iter != m_blankFrameURLs.end()) 376 if (iter != m_blankFrameURLs.end())
377 return iter->value; 377 return iter->value;
378 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); 378 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++);
379 KURL fakeURL(ParsedURLString, url); 379 KURL fakeURL(ParsedURLString, url);
380 m_blankFrameURLs.add(frame, fakeURL); 380 m_blankFrameURLs.add(frame, fakeURL);
381 381
382 return fakeURL; 382 return fakeURL;
383 } 383 }
384 384
385 } 385 }
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