| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 { | 69 { |
| 70 RefPtrWillBeRawPtr<SliderThumbElement> element = adoptRefWillBeNoop(new Slid
erThumbElement(document)); | 70 RefPtrWillBeRawPtr<SliderThumbElement> element = adoptRefWillBeNoop(new Slid
erThumbElement(document)); |
| 71 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); | 71 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); |
| 72 return element.release(); | 72 return element.release(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void SliderThumbElement::setPositionFromValue() | 75 void SliderThumbElement::setPositionFromValue() |
| 76 { | 76 { |
| 77 // Since the code to calculate position is in the LayoutSliderThumb layout | 77 // Since the code to calculate position is in the LayoutSliderThumb layout |
| 78 // path, we don't actually update the value here. Instead, we poke at the | 78 // path, we don't actually update the value here. Instead, we poke at the |
| 79 // renderer directly to trigger layout. | 79 // layoutObject directly to trigger layout. |
| 80 if (layoutObject()) | 80 if (layoutObject()) |
| 81 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); | 81 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); |
| 82 } | 82 } |
| 83 | 83 |
| 84 LayoutObject* SliderThumbElement::createLayoutObject(const ComputedStyle&) | 84 LayoutObject* SliderThumbElement::createLayoutObject(const ComputedStyle&) |
| 85 { | 85 { |
| 86 return new LayoutSliderThumb(this); | 86 return new LayoutSliderThumb(this); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool SliderThumbElement::isDisabledFormControl() const | 89 bool SliderThumbElement::isDisabledFormControl() const |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox()) | 121 if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox()) |
| 122 return; | 122 return; |
| 123 | 123 |
| 124 LayoutPoint offset = roundedLayoutPoint(input->layoutObject()->absoluteToLoc
al(FloatPoint(point), UseTransforms)); | 124 LayoutPoint offset = roundedLayoutPoint(input->layoutObject()->absoluteToLoc
al(FloatPoint(point), UseTransforms)); |
| 125 bool isVertical = hasVerticalAppearance(input.get()); | 125 bool isVertical = hasVerticalAppearance(input.get()); |
| 126 bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection()
; | 126 bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection()
; |
| 127 LayoutUnit trackSize; | 127 LayoutUnit trackSize; |
| 128 LayoutUnit position; | 128 LayoutUnit position; |
| 129 LayoutUnit currentPosition; | 129 LayoutUnit currentPosition; |
| 130 // We need to calculate currentPosition from absolute points becaue the | 130 // We need to calculate currentPosition from absolute points becaue the |
| 131 // renderer for this node is usually on a layer and layoutBox()->x() and | 131 // layoutObject for this node is usually on a layer and layoutBox()->x() and |
| 132 // y() are unusable. | 132 // y() are unusable. |
| 133 // FIXME: This should probably respect transforms. | 133 // FIXME: This should probably respect transforms. |
| 134 LayoutPoint absoluteThumbOrigin = layoutBox()->absoluteBoundingBoxRectIgnori
ngTransforms().location(); | 134 LayoutPoint absoluteThumbOrigin = layoutBox()->absoluteBoundingBoxRectIgnori
ngTransforms().location(); |
| 135 LayoutPoint absoluteSliderContentOrigin = roundedLayoutPoint(input->layoutOb
ject()->localToAbsolute()); | 135 LayoutPoint absoluteSliderContentOrigin = roundedLayoutPoint(input->layoutOb
ject()->localToAbsolute()); |
| 136 IntRect trackBoundingBox = trackElement->layoutObject()->absoluteBoundingBox
RectIgnoringTransforms(); | 136 IntRect trackBoundingBox = trackElement->layoutObject()->absoluteBoundingBox
RectIgnoringTransforms(); |
| 137 IntRect inputBoundingBox = input->layoutObject()->absoluteBoundingBoxRectIgn
oringTransforms(); | 137 IntRect inputBoundingBox = input->layoutObject()->absoluteBoundingBoxRectIgn
oringTransforms(); |
| 138 if (isVertical) { | 138 if (isVertical) { |
| 139 trackSize = trackElement->layoutBox()->contentHeight() - layoutBox()->si
ze().height(); | 139 trackSize = trackElement->layoutBox()->contentHeight() - layoutBox()->si
ze().height(); |
| 140 position = offset.y() - layoutBox()->size().height() / 2 - trackBounding
Box.y() + inputBoundingBox.y() - layoutBox()->marginBottom(); | 140 position = offset.y() - layoutBox()->size().height() / 2 - trackBounding
Box.y() + inputBoundingBox.y() - layoutBox()->marginBottom(); |
| 141 currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.
y(); | 141 currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.
y(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 case MediaVolumeSliderThumbPart: | 327 case MediaVolumeSliderThumbPart: |
| 328 case MediaFullScreenVolumeSliderPart: | 328 case MediaFullScreenVolumeSliderPart: |
| 329 case MediaFullScreenVolumeSliderThumbPart: | 329 case MediaFullScreenVolumeSliderThumbPart: |
| 330 return mediaSliderContainer; | 330 return mediaSliderContainer; |
| 331 default: | 331 default: |
| 332 return sliderContainer; | 332 return sliderContainer; |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 } | 336 } |
| OLD | NEW |