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

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

Issue 1865813002: Remove RawPtr from Source/web/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return WebString(); 174 return WebString();
175 } 175 }
176 176
177 WebElementCollection WebDocument::all() 177 WebElementCollection WebDocument::all()
178 { 178 {
179 return WebElementCollection(unwrap<Document>()->all()); 179 return WebElementCollection(unwrap<Document>()->all());
180 } 180 }
181 181
182 void WebDocument::forms(WebVector<WebFormElement>& results) const 182 void WebDocument::forms(WebVector<WebFormElement>& results) const
183 { 183 {
184 RawPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>() )->forms(); 184 HTMLCollection* forms = const_cast<Document*>(constUnwrap<Document>())->form s();
185 size_t sourceLength = forms->length(); 185 size_t sourceLength = forms->length();
186 Vector<WebFormElement> temp; 186 Vector<WebFormElement> temp;
187 temp.reserveCapacity(sourceLength); 187 temp.reserveCapacity(sourceLength);
188 for (size_t i = 0; i < sourceLength; ++i) { 188 for (size_t i = 0; i < sourceLength; ++i) {
189 Element* element = forms->item(i); 189 Element* element = forms->item(i);
190 // Strange but true, sometimes node can be 0. 190 // Strange but true, sometimes node can be 0.
191 if (element && element->isHTMLElement()) 191 if (element && element->isHTMLElement())
192 temp.append(WebFormElement(toHTMLFormElement(element))); 192 temp.append(WebFormElement(toHTMLFormElement(element)));
193 } 193 }
194 results.assign(temp); 194 results.assign(temp);
195 } 195 }
196 196
197 WebURL WebDocument::completeURL(const WebString& partialURL) const 197 WebURL WebDocument::completeURL(const WebString& partialURL) const
198 { 198 {
199 return constUnwrap<Document>()->completeURL(partialURL); 199 return constUnwrap<Document>()->completeURL(partialURL);
200 } 200 }
201 201
202 WebElement WebDocument::getElementById(const WebString& id) const 202 WebElement WebDocument::getElementById(const WebString& id) const
203 { 203 {
204 return WebElement(constUnwrap<Document>()->getElementById(id)); 204 return WebElement(constUnwrap<Document>()->getElementById(id));
205 } 205 }
206 206
207 WebElement WebDocument::focusedElement() const 207 WebElement WebDocument::focusedElement() const
208 { 208 {
209 return WebElement(constUnwrap<Document>()->focusedElement()); 209 return WebElement(constUnwrap<Document>()->focusedElement());
210 } 210 }
211 211
212 void WebDocument::insertStyleSheet(const WebString& sourceCode) 212 void WebDocument::insertStyleSheet(const WebString& sourceCode)
213 { 213 {
214 RawPtr<Document> document = unwrap<Document>(); 214 Document* document = unwrap<Document>();
215 DCHECK(document); 215 DCHECK(document);
216 RawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(CSSParse rContext(*document, 0)); 216 StyleSheetContents* parsedSheet = StyleSheetContents::create(CSSParserContex t(*document, 0));
217 parsedSheet->parseString(sourceCode); 217 parsedSheet->parseString(sourceCode);
218 document->styleEngine().injectAuthorSheet(parsedSheet); 218 document->styleEngine().injectAuthorSheet(parsedSheet);
219 } 219 }
220 220
221 void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors) 221 void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors)
222 { 222 {
223 RawPtr<Document> document = unwrap<Document>(); 223 Document* document = unwrap<Document>();
224 CSSSelectorWatch* watch = CSSSelectorWatch::fromIfExists(*document); 224 CSSSelectorWatch* watch = CSSSelectorWatch::fromIfExists(*document);
225 if (!watch && webSelectors.isEmpty()) 225 if (!watch && webSelectors.isEmpty())
226 return; 226 return;
227 Vector<String> selectors; 227 Vector<String> selectors;
228 selectors.append(webSelectors.data(), webSelectors.size()); 228 selectors.append(webSelectors.data(), webSelectors.size());
229 CSSSelectorWatch::from(*document).watchCSSSelectors(selectors); 229 CSSSelectorWatch::from(*document).watchCSSSelectors(selectors);
230 } 230 }
231 231
232 void WebDocument::cancelFullScreen() 232 void WebDocument::cancelFullScreen()
233 { 233 {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (!linkElement) 321 if (!linkElement)
322 return false; 322 return false;
323 return equalIgnoringCase(linkElement->fastGetAttribute(HTMLNames::crossorigi nAttr), "use-credentials"); 323 return equalIgnoringCase(linkElement->fastGetAttribute(HTMLNames::crossorigi nAttr), "use-credentials");
324 } 324 }
325 325
326 WebDistillabilityFeatures WebDocument::distillabilityFeatures() 326 WebDistillabilityFeatures WebDocument::distillabilityFeatures()
327 { 327 {
328 return DocumentStatisticsCollector::collectStatistics(*unwrap<Document>()); 328 return DocumentStatisticsCollector::collectStatistics(*unwrap<Document>());
329 } 329 }
330 330
331 WebDocument::WebDocument(const RawPtr<Document>& elem) 331 WebDocument::WebDocument(Document* elem)
332 : WebNode(elem) 332 : WebNode(elem)
333 { 333 {
334 } 334 }
335 335
336 DEFINE_WEB_NODE_TYPE_CASTS(WebDocument, constUnwrap<Node>()->isDocumentNode()); 336 DEFINE_WEB_NODE_TYPE_CASTS(WebDocument, constUnwrap<Node>()->isDocumentNode());
337 337
338 WebDocument& WebDocument::operator=(const RawPtr<Document>& elem) 338 WebDocument& WebDocument::operator=(Document*elem)
339 { 339 {
340 m_private = elem; 340 m_private = elem;
341 return *this; 341 return *this;
342 } 342 }
343 343
344 WebDocument::operator RawPtr<Document>() const 344 WebDocument::operator Document*() const
345 { 345 {
346 return toDocument(m_private.get()); 346 return toDocument(m_private.get());
347 } 347 }
348 348
349 } // namespace blink 349 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp ('k') | third_party/WebKit/Source/web/WebElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698