OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |