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

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

Issue 334593005: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/html/HTMLSourceElement.cpp ('k') | Source/core/html/HTMLTrackElement.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) 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 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 30 matching lines...) Expand all
41 #include "core/html/HTMLBRElement.h" 41 #include "core/html/HTMLBRElement.h"
42 #include "core/html/shadow/ShadowElementNames.h" 42 #include "core/html/shadow/ShadowElementNames.h"
43 #include "core/rendering/RenderBlock.h" 43 #include "core/rendering/RenderBlock.h"
44 #include "core/rendering/RenderTheme.h" 44 #include "core/rendering/RenderTheme.h"
45 #include "platform/heap/Handle.h" 45 #include "platform/heap/Handle.h"
46 #include "wtf/text/StringBuilder.h" 46 #include "wtf/text/StringBuilder.h"
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 using namespace HTMLNames; 50 using namespace HTMLNames;
51 using namespace std;
52 51
53 HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagN ame, Document& doc, HTMLFormElement* form) 52 HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName& tagN ame, Document& doc, HTMLFormElement* form)
54 : HTMLFormControlElementWithState(tagName, doc, form) 53 : HTMLFormControlElementWithState(tagName, doc, form)
55 , m_lastChangeWasUserEdit(false) 54 , m_lastChangeWasUserEdit(false)
56 , m_cachedSelectionStart(0) 55 , m_cachedSelectionStart(0)
57 , m_cachedSelectionEnd(0) 56 , m_cachedSelectionEnd(0)
58 , m_cachedSelectionDirection(SelectionHasNoDirection) 57 , m_cachedSelectionDirection(SelectionHasNoDirection)
59 { 58 {
60 } 59 }
61 60
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (!placeholderElement() || placeholderValueChanged) 156 if (!placeholderElement() || placeholderValueChanged)
158 updatePlaceholderText(); 157 updatePlaceholderText();
159 HTMLElement* placeholder = placeholderElement(); 158 HTMLElement* placeholder = placeholderElement();
160 if (!placeholder) 159 if (!placeholder)
161 return; 160 return;
162 placeholder->setInlineStyleProperty(CSSPropertyVisibility, placeholderShould BeVisible() ? CSSValueVisible : CSSValueHidden); 161 placeholder->setInlineStyleProperty(CSSPropertyVisibility, placeholderShould BeVisible() ? CSSValueVisible : CSSValueHidden);
163 } 162 }
164 163
165 void HTMLTextFormControlElement::setSelectionStart(int start) 164 void HTMLTextFormControlElement::setSelectionStart(int start)
166 { 165 {
167 setSelectionRange(start, max(start, selectionEnd()), selectionDirection()); 166 setSelectionRange(start, std::max(start, selectionEnd()), selectionDirection ());
168 } 167 }
169 168
170 void HTMLTextFormControlElement::setSelectionEnd(int end) 169 void HTMLTextFormControlElement::setSelectionEnd(int end)
171 { 170 {
172 setSelectionRange(min(end, selectionStart()), end, selectionDirection()); 171 setSelectionRange(std::min(end, selectionStart()), end, selectionDirection() );
173 } 172 }
174 173
175 void HTMLTextFormControlElement::setSelectionDirection(const String& direction) 174 void HTMLTextFormControlElement::setSelectionDirection(const String& direction)
176 { 175 {
177 setSelectionRange(selectionStart(), selectionEnd(), direction); 176 setSelectionRange(selectionStart(), selectionEnd(), direction);
178 } 177 }
179 178
180 void HTMLTextFormControlElement::select() 179 void HTMLTextFormControlElement::select()
181 { 180 {
182 setSelectionRange(0, numeric_limits<int>::max(), SelectionHasNoDirection); 181 setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirectio n);
183 } 182 }
184 183
185 bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& ol dValue, String& newValue) 184 bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& ol dValue, String& newValue)
186 { 185 {
187 return !equalIgnoringNullity(oldValue, newValue); 186 return !equalIgnoringNullity(oldValue, newValue);
188 } 187 }
189 188
190 void HTMLTextFormControlElement::dispatchFormControlChangeEvent() 189 void HTMLTextFormControlElement::dispatchFormControlChangeEvent()
191 { 190 {
192 String newValue = value(); 191 String newValue = value();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 return setSelectionRange(start, end, direction); 275 return setSelectionRange(start, end, direction);
277 } 276 }
278 277
279 void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField SelectionDirection direction) 278 void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField SelectionDirection direction)
280 { 279 {
281 document().updateLayoutIgnorePendingStylesheets(); 280 document().updateLayoutIgnorePendingStylesheets();
282 281
283 if (!renderer() || !renderer()->isTextControl()) 282 if (!renderer() || !renderer()->isTextControl())
284 return; 283 return;
285 284
286 end = max(end, 0); 285 end = std::max(end, 0);
287 start = min(max(start, 0), end); 286 start = std::min(std::max(start, 0), end);
288 287
289 if (!hasVisibleTextArea(renderer(), innerTextElement())) { 288 if (!hasVisibleTextArea(renderer(), innerTextElement())) {
290 cacheSelection(start, end, direction); 289 cacheSelection(start, end, direction);
291 return; 290 return;
292 } 291 }
293 VisiblePosition startPosition = visiblePositionForIndex(start); 292 VisiblePosition startPosition = visiblePositionForIndex(start);
294 VisiblePosition endPosition; 293 VisiblePosition endPosition;
295 if (start == end) 294 if (start == end)
296 endPosition = startPosition; 295 endPosition = startPosition;
297 else 296 else
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 653
655 return "ltr"; 654 return "ltr";
656 } 655 }
657 656
658 HTMLElement* HTMLTextFormControlElement::innerTextElement() const 657 HTMLElement* HTMLTextFormControlElement::innerTextElement() const
659 { 658 {
660 return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementName s::innerEditor())); 659 return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementName s::innerEditor()));
661 } 660 }
662 661
663 } // namespace Webcore 662 } // namespace Webcore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLSourceElement.cpp ('k') | Source/core/html/HTMLTrackElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698