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

Side by Side Diff: Source/core/rendering/RenderListBox.cpp

Issue 14996003: Disabled select element should not fire onchange event. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added test and moved the checks to RenderListBox Created 7 years, 7 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/HTMLSelectElement.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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 return offset + rows - 1; 555 return offset + rows - 1;
556 556
557 return listIndexAtOffset(positionOffset); 557 return listIndexAtOffset(positionOffset);
558 } 558 }
559 559
560 void RenderListBox::autoscroll(const IntPoint&) 560 void RenderListBox::autoscroll(const IntPoint&)
561 { 561 {
562 IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->la stKnownMousePosition()); 562 IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->la stKnownMousePosition());
563 563
564 int endIndex = scrollToward(pos); 564 int endIndex = scrollToward(pos);
565 if (selectElement()->isDisabledFormControl())
566 return;
567
565 if (endIndex >= 0) { 568 if (endIndex >= 0) {
566 HTMLSelectElement* select = selectElement(); 569 HTMLSelectElement* select = selectElement();
567 m_inAutoscroll = true; 570 m_inAutoscroll = true;
568 571
569 if (!select->multiple()) 572 if (!select->multiple())
570 select->setActiveSelectionAnchorIndex(endIndex); 573 select->setActiveSelectionAnchorIndex(endIndex);
571 574
572 select->setActiveSelectionEndIndex(endIndex); 575 select->setActiveSelectionEndIndex(endIndex);
573 select->updateListBoxSelection(!select->multiple()); 576 select->updateListBoxSelection(!select->multiple());
574 m_inAutoscroll = false; 577 m_inAutoscroll = false;
575 } 578 }
576 } 579 }
577 580
578 void RenderListBox::stopAutoscroll() 581 void RenderListBox::stopAutoscroll()
579 { 582 {
583 if (selectElement()->isDisabledFormControl())
584 return;
585
580 selectElement()->listBoxOnChange(); 586 selectElement()->listBoxOnChange();
581 } 587 }
582 588
583 bool RenderListBox::scrollToRevealElementAtListIndex(int index) 589 bool RenderListBox::scrollToRevealElementAtListIndex(int index)
584 { 590 {
585 if (index < 0 || index >= numItems() || listIndexIsVisible(index)) 591 if (index < 0 || index >= numItems() || listIndexIsVisible(index))
586 return false; 592 return false;
587 593
588 int newOffset; 594 int newOffset;
589 if (index < m_indexOffset) 595 if (index < m_indexOffset)
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 885
880 if (m_vBar) 886 if (m_vBar)
881 m_vBar->styleChanged(); 887 m_vBar->styleChanged();
882 888
883 // Force an update since we know the scrollbars have changed things. 889 // Force an update since we know the scrollbars have changed things.
884 if (document()->hasAnnotatedRegions()) 890 if (document()->hasAnnotatedRegions())
885 document()->setAnnotatedRegionsDirty(true); 891 document()->setAnnotatedRegionsDirty(true);
886 } 892 }
887 893
888 } // namespace WebCore 894 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLSelectElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698