| 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. |
| 4 * (http://www.torchmobile.com/) |
| 4 * | 5 * |
| 5 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 7 * are met: | 8 * are met: |
| 8 * | 9 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 11 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
| 12 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
| 13 * documentation and/or other materials provided with the distribution. | 14 * documentation and/or other materials provided with the distribution. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 #include "core/dom/ElementTraversal.h" | 33 #include "core/dom/ElementTraversal.h" |
| 33 #include "core/html/HTMLDivElement.h" | 34 #include "core/html/HTMLDivElement.h" |
| 34 #include "core/html/HTMLOptGroupElement.h" | 35 #include "core/html/HTMLOptGroupElement.h" |
| 35 #include "core/html/HTMLOptionElement.h" | 36 #include "core/html/HTMLOptionElement.h" |
| 36 #include "core/html/HTMLSelectElement.h" | 37 #include "core/html/HTMLSelectElement.h" |
| 37 #include "core/paint/PaintLayer.h" | 38 #include "core/paint/PaintLayer.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 // Default size when the multiple attribute is present but size attribute is abs
ent. | 42 // Default size when the multiple attribute is present but size attribute is |
| 43 // absent. |
| 42 const int defaultSize = 4; | 44 const int defaultSize = 4; |
| 43 | 45 |
| 44 const int defaultPaddingBottom = 1; | 46 const int defaultPaddingBottom = 1; |
| 45 | 47 |
| 46 LayoutListBox::LayoutListBox(Element* element) : LayoutBlockFlow(element) { | 48 LayoutListBox::LayoutListBox(Element* element) : LayoutBlockFlow(element) { |
| 47 ASSERT(element); | 49 ASSERT(element); |
| 48 ASSERT(element->isHTMLElement()); | 50 ASSERT(element->isHTMLElement()); |
| 49 ASSERT(isHTMLSelectElement(element)); | 51 ASSERT(isHTMLSelectElement(element)); |
| 50 } | 52 } |
| 51 | 53 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 maxHeight = std::max(maxHeight, itemHeight); | 91 maxHeight = std::max(maxHeight, itemHeight); |
| 90 } | 92 } |
| 91 return maxHeight; | 93 return maxHeight; |
| 92 } | 94 } |
| 93 | 95 |
| 94 void LayoutListBox::computeLogicalHeight( | 96 void LayoutListBox::computeLogicalHeight( |
| 95 LayoutUnit, | 97 LayoutUnit, |
| 96 LayoutUnit logicalTop, | 98 LayoutUnit logicalTop, |
| 97 LogicalExtentComputedValues& computedValues) const { | 99 LogicalExtentComputedValues& computedValues) const { |
| 98 LayoutUnit height = itemHeight() * size(); | 100 LayoutUnit height = itemHeight() * size(); |
| 99 // FIXME: The item height should have been added before updateLogicalHeight wa
s called to avoid this hack. | 101 // FIXME: The item height should have been added before updateLogicalHeight |
| 102 // was called to avoid this hack. |
| 100 setIntrinsicContentLogicalHeight(height); | 103 setIntrinsicContentLogicalHeight(height); |
| 101 | 104 |
| 102 height += borderAndPaddingHeight(); | 105 height += borderAndPaddingHeight(); |
| 103 | 106 |
| 104 LayoutBox::computeLogicalHeight(height, logicalTop, computedValues); | 107 LayoutBox::computeLogicalHeight(height, logicalTop, computedValues); |
| 105 } | 108 } |
| 106 | 109 |
| 107 void LayoutListBox::stopAutoscroll() { | 110 void LayoutListBox::stopAutoscroll() { |
| 108 HTMLSelectElement* select = selectElement(); | 111 HTMLSelectElement* select = selectElement(); |
| 109 if (select->isDisabledFormControl()) | 112 if (select->isDisabledFormControl()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 124 if (hasOverflowClip()) { | 127 if (hasOverflowClip()) { |
| 125 ASSERT(layer()); | 128 ASSERT(layer()); |
| 126 ASSERT(layer()->getScrollableArea()); | 129 ASSERT(layer()->getScrollableArea()); |
| 127 layer()->getScrollableArea()->scrollIntoView( | 130 layer()->getScrollableArea()->scrollIntoView( |
| 128 rect, ScrollAlignment::alignToEdgeIfNeeded, | 131 rect, ScrollAlignment::alignToEdgeIfNeeded, |
| 129 ScrollAlignment::alignToEdgeIfNeeded); | 132 ScrollAlignment::alignToEdgeIfNeeded); |
| 130 } | 133 } |
| 131 } | 134 } |
| 132 | 135 |
| 133 } // namespace blink | 136 } // namespace blink |
| OLD | NEW |