OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
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 are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 inline static Decimal sliderPosition(HTMLInputElement* element) | 51 inline static Decimal sliderPosition(HTMLInputElement* element) |
52 { | 52 { |
53 const StepRange stepRange(element->createStepRange(RejectAny)); | 53 const StepRange stepRange(element->createStepRange(RejectAny)); |
54 const Decimal oldValue = parseToDecimalForNumberType(element->value(), stepR
ange.defaultValue()); | 54 const Decimal oldValue = parseToDecimalForNumberType(element->value(), stepR
ange.defaultValue()); |
55 return stepRange.proportionFromValue(stepRange.clampValue(oldValue)); | 55 return stepRange.proportionFromValue(stepRange.clampValue(oldValue)); |
56 } | 56 } |
57 | 57 |
58 inline static bool hasVerticalAppearance(HTMLInputElement* input) | 58 inline static bool hasVerticalAppearance(HTMLInputElement* input) |
59 { | 59 { |
60 ASSERT(input->renderer()); | 60 ASSERT(input->layoutObject()); |
61 const LayoutStyle& sliderStyle = input->renderer()->styleRef(); | 61 const LayoutStyle& sliderStyle = input->layoutObject()->styleRef(); |
62 | 62 |
63 return sliderStyle.appearance() == SliderVerticalPart; | 63 return sliderStyle.appearance() == SliderVerticalPart; |
64 } | 64 } |
65 | 65 |
66 void LayoutSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, Layou
tUnit logicalTop, LogicalExtentComputedValues& computedValues) const | 66 void LayoutSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, Layou
tUnit logicalTop, LogicalExtentComputedValues& computedValues) const |
67 { | 67 { |
68 HTMLInputElement* input = toHTMLInputElement(node()->shadowHost()); | 68 HTMLInputElement* input = toHTMLInputElement(node()->shadowHost()); |
69 bool isVertical = hasVerticalAppearance(input); | 69 bool isVertical = hasVerticalAppearance(input); |
70 | 70 |
71 if (input->renderer()->isSlider() && !isVertical && input->list()) { | 71 if (input->layoutObject()->isSlider() && !isVertical && input->list()) { |
72 int offsetFromCenter = LayoutTheme::theme().sliderTickOffsetFromTrackCen
ter(); | 72 int offsetFromCenter = LayoutTheme::theme().sliderTickOffsetFromTrackCen
ter(); |
73 LayoutUnit trackHeight = 0; | 73 LayoutUnit trackHeight = 0; |
74 if (offsetFromCenter < 0) { | 74 if (offsetFromCenter < 0) { |
75 trackHeight = -2 * offsetFromCenter; | 75 trackHeight = -2 * offsetFromCenter; |
76 } else { | 76 } else { |
77 int tickLength = LayoutTheme::theme().sliderTickSize().height(); | 77 int tickLength = LayoutTheme::theme().sliderTickSize().height(); |
78 trackHeight = 2 * (offsetFromCenter + tickLength); | 78 trackHeight = 2 * (offsetFromCenter + tickLength); |
79 } | 79 } |
80 float zoomFactor = style()->effectiveZoom(); | 80 float zoomFactor = style()->effectiveZoom(); |
81 if (zoomFactor != 1.0) | 81 if (zoomFactor != 1.0) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 thumbLocation.setX(thumbLocation.x() - offset); | 140 thumbLocation.setX(thumbLocation.x() - offset); |
141 thumb->setLocation(thumbLocation); | 141 thumb->setLocation(thumbLocation); |
142 | 142 |
143 // We need one-off invalidation code here because painting of the timeline e
lement does not go through style. | 143 // We need one-off invalidation code here because painting of the timeline e
lement does not go through style. |
144 // Instead it has a custom implementation in C++ code. | 144 // Instead it has a custom implementation in C++ code. |
145 // Therefore the style system cannot understand when it needs to be paint in
validated. | 145 // Therefore the style system cannot understand when it needs to be paint in
validated. |
146 setShouldDoFullPaintInvalidation(); | 146 setShouldDoFullPaintInvalidation(); |
147 } | 147 } |
148 | 148 |
149 } // namespace blink | 149 } // namespace blink |
OLD | NEW |