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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 inline static bool hasVerticalAppearance(HTMLInputElement* input) | 56 inline static bool hasVerticalAppearance(HTMLInputElement* input) |
57 { | 57 { |
58 ASSERT(input->layoutObject()); | 58 ASSERT(input->layoutObject()); |
59 const ComputedStyle& sliderStyle = input->layoutObject()->styleRef(); | 59 const ComputedStyle& sliderStyle = input->layoutObject()->styleRef(); |
60 | 60 |
61 return sliderStyle.appearance() == SliderVerticalPart; | 61 return sliderStyle.appearance() == SliderVerticalPart; |
62 } | 62 } |
63 | 63 |
64 void LayoutSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, Layou
tUnit logicalTop, LogicalExtentComputedValues& computedValues) const | 64 void LayoutSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, Layou
tUnit logicalTop, LogicalExtentComputedValues& computedValues) const |
65 { | 65 { |
66 HTMLInputElement* input = toHTMLInputElement(node()->shadowHost()); | 66 HTMLInputElement* input = toHTMLInputElement(node()->ownerShadowHost()); |
67 bool isVertical = hasVerticalAppearance(input); | 67 bool isVertical = hasVerticalAppearance(input); |
68 | 68 |
69 if (input->layoutObject()->isSlider() && !isVertical && input->list()) { | 69 if (input->layoutObject()->isSlider() && !isVertical && input->list()) { |
70 int offsetFromCenter = LayoutTheme::theme().sliderTickOffsetFromTrackCen
ter(); | 70 int offsetFromCenter = LayoutTheme::theme().sliderTickOffsetFromTrackCen
ter(); |
71 LayoutUnit trackHeight; | 71 LayoutUnit trackHeight; |
72 if (offsetFromCenter < 0) { | 72 if (offsetFromCenter < 0) { |
73 trackHeight = LayoutUnit(-2 * offsetFromCenter); | 73 trackHeight = LayoutUnit(-2 * offsetFromCenter); |
74 } else { | 74 } else { |
75 int tickLength = LayoutTheme::theme().sliderTickSize().height(); | 75 int tickLength = LayoutTheme::theme().sliderTickSize().height(); |
76 trackHeight = LayoutUnit(2 * (offsetFromCenter + tickLength)); | 76 trackHeight = LayoutUnit(2 * (offsetFromCenter + tickLength)); |
(...skipping 12 matching lines...) Expand all Loading... |
89 logicalHeight = LayoutUnit(LayoutSlider::defaultTrackLength); | 89 logicalHeight = LayoutUnit(LayoutSlider::defaultTrackLength); |
90 | 90 |
91 // FIXME: The trackHeight should have been added before updateLogicalHeight
was called to avoid this hack. | 91 // FIXME: The trackHeight should have been added before updateLogicalHeight
was called to avoid this hack. |
92 setIntrinsicContentLogicalHeight(logicalHeight); | 92 setIntrinsicContentLogicalHeight(logicalHeight); |
93 | 93 |
94 LayoutBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues); | 94 LayoutBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues); |
95 } | 95 } |
96 | 96 |
97 void LayoutSliderContainer::layout() | 97 void LayoutSliderContainer::layout() |
98 { | 98 { |
99 HTMLInputElement* input = toHTMLInputElement(node()->shadowHost()); | 99 HTMLInputElement* input = toHTMLInputElement(node()->ownerShadowHost()); |
100 bool isVertical = hasVerticalAppearance(input); | 100 bool isVertical = hasVerticalAppearance(input); |
101 mutableStyleRef().setFlexDirection(isVertical ? FlowColumn : FlowRow); | 101 mutableStyleRef().setFlexDirection(isVertical ? FlowColumn : FlowRow); |
102 TextDirection oldTextDirection = style()->direction(); | 102 TextDirection oldTextDirection = style()->direction(); |
103 if (isVertical) { | 103 if (isVertical) { |
104 // FIXME: Work around rounding issues in RTL vertical sliders. We want t
hem to | 104 // FIXME: Work around rounding issues in RTL vertical sliders. We want t
hem to |
105 // render identically to LTR vertical sliders. We can remove this work a
round when | 105 // render identically to LTR vertical sliders. We can remove this work a
round when |
106 // subpixel rendering is enabled on all ports. | 106 // subpixel rendering is enabled on all ports. |
107 mutableStyleRef().setDirection(LTR); | 107 mutableStyleRef().setDirection(LTR); |
108 } | 108 } |
109 | 109 |
(...skipping 28 matching lines...) Expand all Loading... |
138 thumbLocation.setX(thumbLocation.x() - offset); | 138 thumbLocation.setX(thumbLocation.x() - offset); |
139 thumb->setLocation(thumbLocation); | 139 thumb->setLocation(thumbLocation); |
140 | 140 |
141 // We need one-off invalidation code here because painting of the timeline e
lement does not go through style. | 141 // We need one-off invalidation code here because painting of the timeline e
lement does not go through style. |
142 // Instead it has a custom implementation in C++ code. | 142 // Instead it has a custom implementation in C++ code. |
143 // Therefore the style system cannot understand when it needs to be paint in
validated. | 143 // Therefore the style system cannot understand when it needs to be paint in
validated. |
144 setShouldDoFullPaintInvalidation(); | 144 setShouldDoFullPaintInvalidation(); |
145 } | 145 } |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
OLD | NEW |