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

Side by Side Diff: Source/core/html/PasswordInputType.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/LinkResource.cpp ('k') | Source/core/html/RadioInputType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return adoptRef(new PasswordInputType(element)); 48 return adoptRef(new PasswordInputType(element));
49 } 49 }
50 50
51 HTMLElement* PasswordInputType::passwordGeneratorButtonElement() const 51 HTMLElement* PasswordInputType::passwordGeneratorButtonElement() const
52 { 52 {
53 return m_generatorButton.get(); 53 return m_generatorButton.get();
54 } 54 }
55 55
56 bool PasswordInputType::isPasswordGenerationEnabled() const 56 bool PasswordInputType::isPasswordGenerationEnabled() const
57 { 57 {
58 if (Page* page = element()->document()->page()) 58 if (Page* page = element()->document().page())
59 return page->chrome().client().isPasswordGenerationEnabled(); 59 return page->chrome().client().isPasswordGenerationEnabled();
60 return false; 60 return false;
61 } 61 }
62 62
63 bool PasswordInputType::needsContainer() const 63 bool PasswordInputType::needsContainer() const
64 { 64 {
65 return BaseTextInputType::needsContainer() || isPasswordGenerationEnabled(); 65 return BaseTextInputType::needsContainer() || isPasswordGenerationEnabled();
66 } 66 }
67 67
68 void PasswordInputType::createShadowSubtree() 68 void PasswordInputType::createShadowSubtree()
69 { 69 {
70 BaseTextInputType::createShadowSubtree(); 70 BaseTextInputType::createShadowSubtree();
71 if (isPasswordGenerationEnabled()) { 71 if (isPasswordGenerationEnabled()) {
72 m_generatorButton = PasswordGeneratorButtonElement::create(element()->do cument()); 72 m_generatorButton = PasswordGeneratorButtonElement::create(&element()->d ocument());
73 m_generatorButton->decorate(element()); 73 m_generatorButton->decorate(element());
74 } 74 }
75 } 75 }
76 76
77 void PasswordInputType::destroyShadowSubtree() 77 void PasswordInputType::destroyShadowSubtree()
78 { 78 {
79 BaseTextInputType::destroyShadowSubtree(); 79 BaseTextInputType::destroyShadowSubtree();
80 m_generatorButton = 0; 80 m_generatorButton = 0;
81 } 81 }
82 82
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return true; 125 return true;
126 } 126 }
127 127
128 bool PasswordInputType::isPasswordField() const 128 bool PasswordInputType::isPasswordField() const
129 { 129 {
130 return true; 130 return true;
131 } 131 }
132 132
133 void PasswordInputType::enableSecureTextInput() 133 void PasswordInputType::enableSecureTextInput()
134 { 134 {
135 if (element()->document()->frame()) 135 if (element()->document().frame())
136 element()->document()->setUseSecureKeyboardEntryWhenActive(true); 136 element()->document().setUseSecureKeyboardEntryWhenActive(true);
137 } 137 }
138 138
139 void PasswordInputType::disableSecureTextInput() 139 void PasswordInputType::disableSecureTextInput()
140 { 140 {
141 if (element()->document()->frame()) 141 if (element()->document().frame())
142 element()->document()->setUseSecureKeyboardEntryWhenActive(false); 142 element()->document().setUseSecureKeyboardEntryWhenActive(false);
143 } 143 }
144 144
145 } // namespace WebCore 145 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/LinkResource.cpp ('k') | Source/core/html/RadioInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698