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

Side by Side Diff: Source/core/html/InputType.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/ImageInputType.cpp ('k') | Source/core/html/LinkImport.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, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 9 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
10 * 10 *
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return; 389 return;
390 390
391 root->removeChildren(); 391 root->removeChildren();
392 392
393 // It's ok to clear contents of all other ShadowRoots because they must have 393 // It's ok to clear contents of all other ShadowRoots because they must have
394 // been created by InputFieldPasswordGeneratorButtonElement, and we don't al low adding 394 // been created by InputFieldPasswordGeneratorButtonElement, and we don't al low adding
395 // AuthorShadowRoot to HTMLInputElement. 395 // AuthorShadowRoot to HTMLInputElement.
396 // FIXME: Remove the PasswordGeneratorButtonElement's shadow root and then r emove this loop. 396 // FIXME: Remove the PasswordGeneratorButtonElement's shadow root and then r emove this loop.
397 while ((root = root->youngerShadowRoot())) { 397 while ((root = root->youngerShadowRoot())) {
398 root->removeChildren(); 398 root->removeChildren();
399 root->appendChild(HTMLShadowElement::create(shadowTag, element()->docume nt())); 399 root->appendChild(HTMLShadowElement::create(shadowTag, &element()->docum ent()));
400 } 400 }
401 } 401 }
402 402
403 Decimal InputType::parseToNumber(const String&, const Decimal& defaultValue) con st 403 Decimal InputType::parseToNumber(const String&, const Decimal& defaultValue) con st
404 { 404 {
405 ASSERT_NOT_REACHED(); 405 ASSERT_NOT_REACHED();
406 return defaultValue; 406 return defaultValue;
407 } 407 }
408 408
409 Decimal InputType::parseToNumberOrNaN(const String& string) const 409 Decimal InputType::parseToNumberOrNaN(const String& string) const
(...skipping 15 matching lines...) Expand all
425 425
426 void InputType::dispatchSimulatedClickIfActive(KeyboardEvent* event) const 426 void InputType::dispatchSimulatedClickIfActive(KeyboardEvent* event) const
427 { 427 {
428 if (element()->active()) 428 if (element()->active())
429 element()->dispatchSimulatedClick(event); 429 element()->dispatchSimulatedClick(event);
430 event->setDefaultHandled(); 430 event->setDefaultHandled();
431 } 431 }
432 432
433 Chrome* InputType::chrome() const 433 Chrome* InputType::chrome() const
434 { 434 {
435 if (Page* page = element()->document()->page()) 435 if (Page* page = element()->document().page())
436 return &page->chrome(); 436 return &page->chrome();
437 return 0; 437 return 0;
438 } 438 }
439 439
440 bool InputType::canSetStringValue() const 440 bool InputType::canSetStringValue() const
441 { 441 {
442 return true; 442 return true;
443 } 443 }
444 444
445 bool InputType::hasCustomFocusLogic() const 445 bool InputType::hasCustomFocusLogic() const
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 820
821 if (newValue - stepRange.maximum() > acceptableErrorValue) { 821 if (newValue - stepRange.maximum() > acceptableErrorValue) {
822 es.throwDOMException(InvalidStateError); 822 es.throwDOMException(InvalidStateError);
823 return; 823 return;
824 } 824 }
825 if (newValue > stepRange.maximum()) 825 if (newValue > stepRange.maximum())
826 newValue = stepRange.maximum(); 826 newValue = stepRange.maximum();
827 827
828 setValueAsDecimal(newValue, eventBehavior, es); 828 setValueAsDecimal(newValue, eventBehavior, es);
829 829
830 if (AXObjectCache* cache = element()->document()->existingAXObjectCache()) 830 if (AXObjectCache* cache = element()->document().existingAXObjectCache())
831 cache->postNotification(element(), AXObjectCache::AXValueChanged, true); 831 cache->postNotification(element(), AXObjectCache::AXValueChanged, true);
832 } 832 }
833 833
834 bool InputType::getAllowedValueStep(Decimal* step) const 834 bool InputType::getAllowedValueStep(Decimal* step) const
835 { 835 {
836 StepRange stepRange(createStepRange(RejectAny)); 836 StepRange stepRange(createStepRange(RejectAny));
837 *step = stepRange.step(); 837 *step = stepRange.step();
838 return stepRange.hasStep(); 838 return stepRange.hasStep();
839 } 839 }
840 840
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 } else { 953 } else {
954 applyStep(n, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_E XCEPTION); 954 applyStep(n, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_E XCEPTION);
955 } 955 }
956 } 956 }
957 } 957 }
958 958
959 void InputType::observeFeatureIfVisible(UseCounter::Feature feature) const 959 void InputType::observeFeatureIfVisible(UseCounter::Feature feature) const
960 { 960 {
961 if (RenderStyle* style = element()->renderStyle()) { 961 if (RenderStyle* style = element()->renderStyle()) {
962 if (style->visibility() != HIDDEN) 962 if (style->visibility() != HIDDEN)
963 UseCounter::count(element()->document(), feature); 963 UseCounter::count(&element()->document(), feature);
964 } 964 }
965 } 965 }
966 966
967 } // namespace WebCore 967 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/ImageInputType.cpp ('k') | Source/core/html/LinkImport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698