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

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

Issue 1419033004: Add feature extraction for distillability to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "public/web/WebDocument.h" 32 #include "public/web/WebDocument.h"
33 33
34 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "bindings/core/v8/ScriptState.h" 35 #include "bindings/core/v8/ScriptState.h"
36 #include "bindings/core/v8/ScriptValue.h" 36 #include "bindings/core/v8/ScriptValue.h"
37 #include "bindings/core/v8/V8ElementRegistrationOptions.h" 37 #include "bindings/core/v8/V8ElementRegistrationOptions.h"
38 #include "core/css/StyleSheetContents.h" 38 #include "core/css/StyleSheetContents.h"
39 #include "core/dom/CSSSelectorWatch.h" 39 #include "core/dom/CSSSelectorWatch.h"
40 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
41 #include "core/dom/DocumentStatisticsCollector.h"
41 #include "core/dom/DocumentType.h" 42 #include "core/dom/DocumentType.h"
42 #include "core/dom/Element.h" 43 #include "core/dom/Element.h"
43 #include "core/dom/Fullscreen.h" 44 #include "core/dom/Fullscreen.h"
44 #include "core/dom/StyleEngine.h" 45 #include "core/dom/StyleEngine.h"
45 #include "core/events/Event.h" 46 #include "core/events/Event.h"
46 #include "core/html/HTMLAllCollection.h" 47 #include "core/html/HTMLAllCollection.h"
47 #include "core/html/HTMLBodyElement.h" 48 #include "core/html/HTMLBodyElement.h"
48 #include "core/html/HTMLCollection.h" 49 #include "core/html/HTMLCollection.h"
49 #include "core/html/HTMLElement.h" 50 #include "core/html/HTMLElement.h"
50 #include "core/html/HTMLFormElement.h" 51 #include "core/html/HTMLFormElement.h"
51 #include "core/html/HTMLHeadElement.h" 52 #include "core/html/HTMLHeadElement.h"
52 #include "core/html/HTMLLinkElement.h" 53 #include "core/html/HTMLLinkElement.h"
53 #include "core/layout/LayoutObject.h" 54 #include "core/layout/LayoutObject.h"
54 #include "core/layout/LayoutView.h" 55 #include "core/layout/LayoutView.h"
55 #include "core/loader/DocumentLoader.h" 56 #include "core/loader/DocumentLoader.h"
56 #include "modules/accessibility/AXObject.h" 57 #include "modules/accessibility/AXObject.h"
57 #include "modules/accessibility/AXObjectCacheImpl.h" 58 #include "modules/accessibility/AXObjectCacheImpl.h"
58 #include "platform/weborigin/SecurityOrigin.h" 59 #include "platform/weborigin/SecurityOrigin.h"
60 #include "public/platform/WebDistillability.h"
59 #include "public/platform/WebURL.h" 61 #include "public/platform/WebURL.h"
60 #include "public/web/WebAXObject.h" 62 #include "public/web/WebAXObject.h"
61 #include "public/web/WebDOMEvent.h" 63 #include "public/web/WebDOMEvent.h"
62 #include "public/web/WebDocumentType.h" 64 #include "public/web/WebDocumentType.h"
63 #include "public/web/WebElement.h" 65 #include "public/web/WebElement.h"
64 #include "public/web/WebElementCollection.h" 66 #include "public/web/WebElementCollection.h"
65 #include "public/web/WebFormElement.h" 67 #include "public/web/WebFormElement.h"
66 #include "public/web/WebNodeList.h" 68 #include "public/web/WebNodeList.h"
67 #include "web/WebLocalFrameImpl.h" 69 #include "web/WebLocalFrameImpl.h"
68 #include "wtf/PassRefPtr.h" 70 #include "wtf/PassRefPtr.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 317
316 bool WebDocument::manifestUseCredentials() const 318 bool WebDocument::manifestUseCredentials() const
317 { 319 {
318 const Document* document = constUnwrap<Document>(); 320 const Document* document = constUnwrap<Document>();
319 HTMLLinkElement* linkElement = document->linkManifest(); 321 HTMLLinkElement* linkElement = document->linkManifest();
320 if (!linkElement) 322 if (!linkElement)
321 return false; 323 return false;
322 return equalIgnoringCase(linkElement->fastGetAttribute(HTMLNames::crossorigi nAttr), "use-credentials"); 324 return equalIgnoringCase(linkElement->fastGetAttribute(HTMLNames::crossorigi nAttr), "use-credentials");
323 } 325 }
324 326
327 WebDistillabilityFeatures WebDocument::distillabilityFeatures()
328 {
329 return DocumentStatisticsCollector::collectStatistics(*unwrap<Document>());
330 }
331
325 WebDocument::WebDocument(const PassRefPtrWillBeRawPtr<Document>& elem) 332 WebDocument::WebDocument(const PassRefPtrWillBeRawPtr<Document>& elem)
326 : WebNode(elem) 333 : WebNode(elem)
327 { 334 {
328 } 335 }
329 336
330 DEFINE_WEB_NODE_TYPE_CASTS(WebDocument, constUnwrap<Node>()->isDocumentNode()); 337 DEFINE_WEB_NODE_TYPE_CASTS(WebDocument, constUnwrap<Node>()->isDocumentNode());
331 338
332 WebDocument& WebDocument::operator=(const PassRefPtrWillBeRawPtr<Document>& elem ) 339 WebDocument& WebDocument::operator=(const PassRefPtrWillBeRawPtr<Document>& elem )
333 { 340 {
334 m_private = elem; 341 m_private = elem;
335 return *this; 342 return *this;
336 } 343 }
337 344
338 WebDocument::operator PassRefPtrWillBeRawPtr<Document>() const 345 WebDocument::operator PassRefPtrWillBeRawPtr<Document>() const
339 { 346 {
340 return toDocument(m_private.get()); 347 return toDocument(m_private.get());
341 } 348 }
342 349
343 } // namespace blink 350 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698