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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2468833002: Count visible password fields on a page (Closed)
Patch Set: dcheng comments Created 4 years, 1 month 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 m_compositorPendingAnimations(new CompositorPendingAnimations()), 497 m_compositorPendingAnimations(new CompositorPendingAnimations()),
498 m_templateDocumentHost(nullptr), 498 m_templateDocumentHost(nullptr),
499 m_didAssociateFormControlsTimer( 499 m_didAssociateFormControlsTimer(
500 TaskRunnerHelper::get(TaskType::Internal, this), 500 TaskRunnerHelper::get(TaskType::Internal, this),
501 this, 501 this,
502 &Document::didAssociateFormControlsTimerFired), 502 &Document::didAssociateFormControlsTimerFired),
503 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()), 503 m_timers(TaskRunnerHelper::get(TaskType::Timer, this)->clone()),
504 m_hasViewportUnits(false), 504 m_hasViewportUnits(false),
505 m_parserSyncPolicy(AllowAsynchronousParsing), 505 m_parserSyncPolicy(AllowAsynchronousParsing),
506 m_nodeCount(0), 506 m_nodeCount(0),
507 m_wouldLoadReason(Created) { 507 m_wouldLoadReason(Created),
508 m_passwordCount(0) {
508 if (m_frame) { 509 if (m_frame) {
509 DCHECK(m_frame->page()); 510 DCHECK(m_frame->page());
510 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); 511 provideContextFeaturesToDocumentFrom(*this, *m_frame->page());
511 512
512 m_fetcher = m_frame->loader().documentLoader()->fetcher(); 513 m_fetcher = m_frame->loader().documentLoader()->fetcher();
513 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this); 514 FrameFetchContext::provideDocumentToContext(m_fetcher->context(), this);
514 515
515 CustomElementRegistry* registry = 516 CustomElementRegistry* registry =
516 m_frame->localDOMWindow() 517 m_frame->localDOMWindow()
517 ? m_frame->localDOMWindow()->maybeCustomElements() 518 ? m_frame->localDOMWindow()->maybeCustomElements()
(...skipping 5824 matching lines...) Expand 10 before | Expand all | Expand 10 after
6342 return LayoutViewItem(m_layoutView); 6343 return LayoutViewItem(m_layoutView);
6343 } 6344 }
6344 6345
6345 PropertyRegistry* Document::propertyRegistry() { 6346 PropertyRegistry* Document::propertyRegistry() {
6346 // TODO(timloh): When the flag is removed, return a reference instead. 6347 // TODO(timloh): When the flag is removed, return a reference instead.
6347 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled()) 6348 if (!m_propertyRegistry && RuntimeEnabledFeatures::cssVariables2Enabled())
6348 m_propertyRegistry = PropertyRegistry::create(); 6349 m_propertyRegistry = PropertyRegistry::create();
6349 return m_propertyRegistry; 6350 return m_propertyRegistry;
6350 } 6351 }
6351 6352
6353 void Document::incrementPasswordCount() {
6354 ++m_passwordCount;
6355 }
6356
6357 void Document::decrementPasswordCount() {
6358 --m_passwordCount;
6359 }
6360
6361 unsigned Document::passwordCount() const {
6362 return m_passwordCount;
6363 }
6364
6352 DEFINE_TRACE(Document) { 6365 DEFINE_TRACE(Document) {
6353 visitor->trace(m_importsController); 6366 visitor->trace(m_importsController);
6354 visitor->trace(m_docType); 6367 visitor->trace(m_docType);
6355 visitor->trace(m_implementation); 6368 visitor->trace(m_implementation);
6356 visitor->trace(m_autofocusElement); 6369 visitor->trace(m_autofocusElement);
6357 visitor->trace(m_focusedElement); 6370 visitor->trace(m_focusedElement);
6358 visitor->trace(m_sequentialFocusNavigationStartingPoint); 6371 visitor->trace(m_sequentialFocusNavigationStartingPoint);
6359 visitor->trace(m_hoverNode); 6372 visitor->trace(m_hoverNode);
6360 visitor->trace(m_activeHoverElement); 6373 visitor->trace(m_activeHoverElement);
6361 visitor->trace(m_documentElement); 6374 visitor->trace(m_documentElement);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
6454 } 6467 }
6455 6468
6456 void showLiveDocumentInstances() { 6469 void showLiveDocumentInstances() {
6457 WeakDocumentSet& set = liveDocumentSet(); 6470 WeakDocumentSet& set = liveDocumentSet();
6458 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6471 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6459 for (Document* document : set) 6472 for (Document* document : set)
6460 fprintf(stderr, "- Document %p URL: %s\n", document, 6473 fprintf(stderr, "- Document %p URL: %s\n", document,
6461 document->url().getString().utf8().data()); 6474 document->url().getString().utf8().data());
6462 } 6475 }
6463 #endif 6476 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698