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

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

Issue 2001453002: Set ComputedStyle on Node and use that in buildOwnLayout() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@storage
Patch Set: Created 4 years, 5 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
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 break; 335 break;
336 case SelectionBehaviorOnFocus::Restore: 336 case SelectionBehaviorOnFocus::Restore:
337 restoreCachedSelection(); 337 restoreCachedSelection();
338 break; 338 break;
339 case SelectionBehaviorOnFocus::None: 339 case SelectionBehaviorOnFocus::None:
340 return; 340 return;
341 } 341 }
342 // TODO(tkent): scrollRectToVisible is a workaround of a bug of 342 // TODO(tkent): scrollRectToVisible is a workaround of a bug of
343 // FrameSelection::revealSelection(). It doesn't scroll correctly in a 343 // FrameSelection::revealSelection(). It doesn't scroll correctly in a
344 // case of RangeSelection. crbug.com/443061. 344 // case of RangeSelection. crbug.com/443061.
345 if (layoutObject()) 345 if (hasLayoutObject())
346 layoutObject()->scrollRectToVisible(boundingBox()); 346 layoutObject()->scrollRectToVisible(boundingBox());
347 if (document().frame()) 347 if (document().frame())
348 document().frame()->selection().revealSelection(); 348 document().frame()->selection().revealSelection();
349 } else { 349 } else {
350 HTMLTextFormControlElement::updateFocusAppearance(selectionBehavior); 350 HTMLTextFormControlElement::updateFocusAppearance(selectionBehavior);
351 } 351 }
352 } 352 }
353 353
354 void HTMLInputElement::beginEditing() 354 void HTMLInputElement::beginEditing()
355 { 355 {
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) 886 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior)
887 { 887 {
888 m_dirtyCheckedness = true; 888 m_dirtyCheckedness = true;
889 if (checked() == nowChecked) 889 if (checked() == nowChecked)
890 return; 890 return;
891 891
892 m_isChecked = nowChecked; 892 m_isChecked = nowChecked;
893 893
894 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) 894 if (RadioButtonGroupScope* scope = radioButtonGroupScope())
895 scope->updateCheckedState(this); 895 scope->updateCheckedState(this);
896 if (layoutObject()) 896 if (hasLayoutObject())
897 LayoutTheme::theme().controlStateChanged(*layoutObject(), CheckedControl State); 897 LayoutTheme::theme().controlStateChanged(*layoutObject(), CheckedControl State);
898 898
899 setNeedsValidityCheck(); 899 setNeedsValidityCheck();
900 900
901 // Ideally we'd do this from the layout tree (matching 901 // Ideally we'd do this from the layout tree (matching
902 // LayoutTextView), but it's not possible to do it at the moment 902 // LayoutTextView), but it's not possible to do it at the moment
903 // because of the way the code is structured. 903 // because of the way the code is structured.
904 if (layoutObject()) { 904 if (hasLayoutObject()) {
905 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) 905 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che())
906 cache->checkedStateChanged(this); 906 cache->checkedStateChanged(this);
907 } 907 }
908 908
909 // Only send a change event for items in the document (avoid firing during 909 // Only send a change event for items in the document (avoid firing during
910 // parsing) and don't send a change event for a radio button that's getting 910 // parsing) and don't send a change event for a radio button that's getting
911 // unchecked to match other browsers. DOM is not a useful standard for this 911 // unchecked to match other browsers. DOM is not a useful standard for this
912 // because it says only to fire change events at "lose focus" time, which is 912 // because it says only to fire change events at "lose focus" time, which is
913 // definitely wrong in practice for these types of elements. 913 // definitely wrong in practice for these types of elements.
914 if (eventBehavior != DispatchNoEvent && inShadowIncludingDocument() && m_inp utType->shouldSendChangeEventAfterCheckedChanged()) { 914 if (eventBehavior != DispatchNoEvent && inShadowIncludingDocument() && m_inp utType->shouldSendChangeEventAfterCheckedChanged()) {
915 setTextAsOfLastFormControlChangeEvent(String()); 915 setTextAsOfLastFormControlChangeEvent(String());
916 if (eventBehavior == DispatchInputAndChangeEvent) 916 if (eventBehavior == DispatchInputAndChangeEvent)
917 dispatchFormControlInputEvent(); 917 dispatchFormControlInputEvent();
918 } 918 }
919 919
920 pseudoStateChanged(CSSSelector::PseudoChecked); 920 pseudoStateChanged(CSSSelector::PseudoChecked);
921 } 921 }
922 922
923 void HTMLInputElement::setIndeterminate(bool newValue) 923 void HTMLInputElement::setIndeterminate(bool newValue)
924 { 924 {
925 if (indeterminate() == newValue) 925 if (indeterminate() == newValue)
926 return; 926 return;
927 927
928 m_isIndeterminate = newValue; 928 m_isIndeterminate = newValue;
929 929
930 pseudoStateChanged(CSSSelector::PseudoIndeterminate); 930 pseudoStateChanged(CSSSelector::PseudoIndeterminate);
931 931
932 if (layoutObject()) 932 if (hasLayoutObject())
933 LayoutTheme::theme().controlStateChanged(*layoutObject(), CheckedControl State); 933 LayoutTheme::theme().controlStateChanged(*layoutObject(), CheckedControl State);
934 } 934 }
935 935
936 int HTMLInputElement::size() const 936 int HTMLInputElement::size() const
937 { 937 {
938 return m_size; 938 return m_size;
939 } 939 }
940 940
941 bool HTMLInputElement::sizeShouldIncludeDecoration(int& preferredSize) const 941 bool HTMLInputElement::sizeShouldIncludeDecoration(int& preferredSize) const
942 { 942 {
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 bool HTMLInputElement::canReceiveDroppedFiles() const 1405 bool HTMLInputElement::canReceiveDroppedFiles() const
1406 { 1406 {
1407 return m_canReceiveDroppedFiles; 1407 return m_canReceiveDroppedFiles;
1408 } 1408 }
1409 1409
1410 void HTMLInputElement::setCanReceiveDroppedFiles(bool canReceiveDroppedFiles) 1410 void HTMLInputElement::setCanReceiveDroppedFiles(bool canReceiveDroppedFiles)
1411 { 1411 {
1412 if (!!m_canReceiveDroppedFiles == canReceiveDroppedFiles) 1412 if (!!m_canReceiveDroppedFiles == canReceiveDroppedFiles)
1413 return; 1413 return;
1414 m_canReceiveDroppedFiles = canReceiveDroppedFiles; 1414 m_canReceiveDroppedFiles = canReceiveDroppedFiles;
1415 if (layoutObject()) 1415 if (hasLayoutObject())
1416 layoutObject()->updateFromElement(); 1416 layoutObject()->updateFromElement();
1417 } 1417 }
1418 1418
1419 String HTMLInputElement::sanitizeValue(const String& proposedValue) const 1419 String HTMLInputElement::sanitizeValue(const String& proposedValue) const
1420 { 1420 {
1421 if (proposedValue.isNull()) 1421 if (proposedValue.isNull())
1422 return proposedValue; 1422 return proposedValue;
1423 return m_inputType->sanitizeValue(proposedValue); 1423 return m_inputType->sanitizeValue(proposedValue);
1424 } 1424 }
1425 1425
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 void HTMLInputElement::ensurePrimaryContent() 1908 void HTMLInputElement::ensurePrimaryContent()
1909 { 1909 {
1910 m_inputTypeView->ensurePrimaryContent(); 1910 m_inputTypeView->ensurePrimaryContent();
1911 } 1911 }
1912 1912
1913 bool HTMLInputElement::hasFallbackContent() const 1913 bool HTMLInputElement::hasFallbackContent() const
1914 { 1914 {
1915 return m_inputTypeView->hasFallbackContent(); 1915 return m_inputTypeView->hasFallbackContent();
1916 } 1916 }
1917 } // namespace blink 1917 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698