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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 1763553002: Invalidate :default pseudo classes when a default button is added or removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: return -> continue Created 4 years, 9 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 | « third_party/WebKit/Source/core/html/HTMLFormElement.cpp ('k') | no next file » | 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) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 468
469 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib ute(typeAttr)); 469 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib ute(typeAttr));
470 if (m_inputType->formControlType() == newTypeName) 470 if (m_inputType->formControlType() == newTypeName)
471 return; 471 return;
472 472
473 RefPtrWillBeRawPtr<InputType> newType = InputType::create(*this, newTypeName ); 473 RefPtrWillBeRawPtr<InputType> newType = InputType::create(*this, newTypeName );
474 removeFromRadioButtonGroup(); 474 removeFromRadioButtonGroup();
475 475
476 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); 476 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute();
477 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr ibutes(); 477 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr ibutes();
478 bool couldBeSuccessfulSubmitButton = canBeSuccessfulSubmitButton();
478 479
479 m_inputTypeView->destroyShadowSubtree(); 480 m_inputTypeView->destroyShadowSubtree();
480 lazyReattachIfAttached(); 481 lazyReattachIfAttached();
481 482
482 m_inputType = newType.release(); 483 m_inputType = newType.release();
483 if (openShadowRoot()) 484 if (openShadowRoot())
484 m_inputTypeView = InputTypeView::create(*this); 485 m_inputTypeView = InputTypeView::create(*this);
485 else 486 else
486 m_inputTypeView = m_inputType; 487 m_inputTypeView = m_inputType;
487 m_inputTypeView->createShadowSubtree(); 488 m_inputTypeView->createShadowSubtree();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 523
523 if (document().focusedElement() == this) 524 if (document().focusedElement() == this)
524 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore); 525 document().updateFocusAppearanceSoon(SelectionBehaviorOnFocus::Restore);
525 526
526 setTextAsOfLastFormControlChangeEvent(value()); 527 setTextAsOfLastFormControlChangeEvent(value());
527 setChangedSinceLastFormControlChangeEvent(false); 528 setChangedSinceLastFormControlChangeEvent(false);
528 529
529 addToRadioButtonGroup(); 530 addToRadioButtonGroup();
530 531
531 setNeedsValidityCheck(); 532 setNeedsValidityCheck();
533 if ((couldBeSuccessfulSubmitButton || canBeSuccessfulSubmitButton()) && form Owner() && inDocument())
534 formOwner()->invalidateDefaultButtonStyle();
532 notifyFormStateChanged(); 535 notifyFormStateChanged();
533 } 536 }
534 537
535 void HTMLInputElement::subtreeHasChanged() 538 void HTMLInputElement::subtreeHasChanged()
536 { 539 {
537 m_inputTypeView->subtreeHasChanged(); 540 m_inputTypeView->subtreeHasChanged();
538 // When typing in an input field, childrenChanged is not called, so we need to force the directionality check. 541 // When typing in an input field, childrenChanged is not called, so we need to force the directionality check.
539 calculateAndAdjustDirectionality(); 542 calculateAndAdjustDirectionality();
540 } 543 }
541 544
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 void HTMLInputElement::ensurePrimaryContent() 1931 void HTMLInputElement::ensurePrimaryContent()
1929 { 1932 {
1930 m_inputTypeView->ensurePrimaryContent(); 1933 m_inputTypeView->ensurePrimaryContent();
1931 } 1934 }
1932 1935
1933 bool HTMLInputElement::hasFallbackContent() const 1936 bool HTMLInputElement::hasFallbackContent() const
1934 { 1937 {
1935 return m_inputTypeView->hasFallbackContent(); 1938 return m_inputTypeView->hasFallbackContent();
1936 } 1939 }
1937 } // namespace blink 1940 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698