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

Side by Side Diff: Source/web/WebDocument.cpp

Issue 18371008: Add a WebDocument::watchCssSelectors(selectors) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Fix most comments; TODO benchmark and use Element::recalcStyle Created 7 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 26 matching lines...) Expand all
37 #include "WebDOMEvent.h" 37 #include "WebDOMEvent.h"
38 #include "WebDocumentType.h" 38 #include "WebDocumentType.h"
39 #include "WebElement.h" 39 #include "WebElement.h"
40 #include "WebFormElement.h" 40 #include "WebFormElement.h"
41 #include "WebFrameImpl.h" 41 #include "WebFrameImpl.h"
42 #include "WebNodeCollection.h" 42 #include "WebNodeCollection.h"
43 #include "WebNodeList.h" 43 #include "WebNodeList.h"
44 #include "core/accessibility/AXObjectCache.h" 44 #include "core/accessibility/AXObjectCache.h"
45 #include "core/css/CSSParserMode.h" 45 #include "core/css/CSSParserMode.h"
46 #include "core/css/StyleSheetContents.h" 46 #include "core/css/StyleSheetContents.h"
47 #include "core/dom/CSSSelectorWatch.h"
47 #include "core/dom/Document.h" 48 #include "core/dom/Document.h"
48 #include "core/dom/DocumentStyleSheetCollection.h" 49 #include "core/dom/DocumentStyleSheetCollection.h"
49 #include "core/dom/DocumentType.h" 50 #include "core/dom/DocumentType.h"
50 #include "core/dom/Element.h" 51 #include "core/dom/Element.h"
51 #include "core/dom/FullscreenController.h" 52 #include "core/dom/FullscreenController.h"
52 #include "core/dom/NodeList.h" 53 #include "core/dom/NodeList.h"
53 #include "core/html/HTMLAllCollection.h" 54 #include "core/html/HTMLAllCollection.h"
54 #include "core/html/HTMLBodyElement.h" 55 #include "core/html/HTMLBodyElement.h"
55 #include "core/html/HTMLCollection.h" 56 #include "core/html/HTMLCollection.h"
56 #include "core/html/HTMLElement.h" 57 #include "core/html/HTMLElement.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 202
202 RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(document .get()); 203 RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(document .get());
203 parsedSheet->setIsUserStyleSheet(styleLevel == UserStyleUserLevel); 204 parsedSheet->setIsUserStyleSheet(styleLevel == UserStyleUserLevel);
204 parsedSheet->parseString(sourceCode); 205 parsedSheet->parseString(sourceCode);
205 if (parsedSheet->isUserStyleSheet()) 206 if (parsedSheet->isUserStyleSheet())
206 document->styleSheetCollection()->addUserSheet(parsedSheet); 207 document->styleSheetCollection()->addUserSheet(parsedSheet);
207 else 208 else
208 document->styleSheetCollection()->addAuthorSheet(parsedSheet); 209 document->styleSheetCollection()->addAuthorSheet(parsedSheet);
209 } 210 }
210 211
212 void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors)
213 {
214 RefPtr<Document> document = unwrap<Document>();
215 Vector<String> selectors;
216 selectors.append(webSelectors.data(), webSelectors.size());
217 CSSSelectorWatch::from(document.get())->watchCSSSelectors(selectors);
218 }
219
211 void WebDocument::cancelFullScreen() 220 void WebDocument::cancelFullScreen()
212 { 221 {
213 if (FullscreenController* fullscreen = FullscreenController::fromIfExists(un wrap<Document>())) 222 if (FullscreenController* fullscreen = FullscreenController::fromIfExists(un wrap<Document>()))
214 fullscreen->webkitCancelFullScreen(); 223 fullscreen->webkitCancelFullScreen();
215 } 224 }
216 225
217 WebElement WebDocument::fullScreenElement() const 226 WebElement WebDocument::fullScreenElement() const
218 { 227 {
219 Element* fullScreenElement = 0; 228 Element* fullScreenElement = 0;
220 if (FullscreenController* fullscreen = FullscreenController::fromIfExists(co nst_cast<WebDocument*>(this)->unwrap<Document>())) 229 if (FullscreenController* fullscreen = FullscreenController::fromIfExists(co nst_cast<WebDocument*>(this)->unwrap<Document>()))
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 m_private = elem; 294 m_private = elem;
286 return *this; 295 return *this;
287 } 296 }
288 297
289 WebDocument::operator PassRefPtr<Document>() const 298 WebDocument::operator PassRefPtr<Document>() const
290 { 299 {
291 return toDocument(m_private.get()); 300 return toDocument(m_private.get());
292 } 301 }
293 302
294 } // namespace WebKit 303 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698