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

Unified Diff: webkit/glue/webframe_impl.cc

Issue 204022: ExtensionShelf now uses the BookmarkExtensionBackground, just like the Bookma... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webframe_impl.cc
===================================================================
--- webkit/glue/webframe_impl.cc (revision 26222)
+++ webkit/glue/webframe_impl.cc (working copy)
@@ -701,7 +701,8 @@
}
#endif
-bool WebFrameImpl::insertStyleText(const WebString& css) {
+bool WebFrameImpl::insertStyleText(
+ const WebString& css, const WebString& id) {
Document* document = frame()->document();
if (!document)
return false;
@@ -709,9 +710,24 @@
if (!document_element)
return false;
+ ExceptionCode err = 0;
+
+ if (!id.isEmpty()) {
+ WebCore::Element* old_element =
+ document->getElementById(webkit_glue::WebStringToString(id));
+ if (old_element) {
+ Node* parent = old_element->parent();
+ if (!parent)
+ return false;
+ parent->removeChild(old_element, err);
+ }
+ }
+
RefPtr<WebCore::Element> stylesheet = document->createElement(
WebCore::HTMLNames::styleTag, false);
- ExceptionCode err = 0;
+ if (!id.isEmpty())
+ stylesheet->setAttribute(WebCore::HTMLNames::idAttr,
+ webkit_glue::WebStringToString(id));
stylesheet->setTextContent(webkit_glue::WebStringToString(css), err);
DCHECK(!err) << "Failed to set style element content";
WebCore::Node* first = document_element->firstChild();
« no previous file with comments | « webkit/glue/webframe_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698