| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) { | 103 void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) { |
| 104 HTMLInputElement* input(hostInput()); | 104 HTMLInputElement* input(hostInput()); |
| 105 Element* trackElement = input->userAgentShadowRoot()->getElementById( | 105 Element* trackElement = input->userAgentShadowRoot()->getElementById( |
| 106 ShadowElementNames::sliderTrack()); | 106 ShadowElementNames::sliderTrack()); |
| 107 | 107 |
| 108 if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox()) | 108 if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox()) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 LayoutPoint offset = roundedLayoutPoint( | 111 LayoutPoint offset = LayoutPoint( |
| 112 input->layoutObject()->absoluteToLocal(FloatPoint(point), UseTransforms)); | 112 input->layoutObject()->absoluteToLocal(FloatPoint(point), UseTransforms)); |
| 113 bool isVertical = hasVerticalAppearance(input); | 113 bool isVertical = hasVerticalAppearance(input); |
| 114 bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection(); | 114 bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection(); |
| 115 LayoutUnit trackSize; | 115 LayoutUnit trackSize; |
| 116 LayoutUnit position; | 116 LayoutUnit position; |
| 117 LayoutUnit currentPosition; | 117 LayoutUnit currentPosition; |
| 118 // We need to calculate currentPosition from absolute points becaue the | 118 // We need to calculate currentPosition from absolute points becaue the |
| 119 // layoutObject for this node is usually on a layer and layoutBox()->x() and | 119 // layoutObject for this node is usually on a layer and layoutBox()->x() and |
| 120 // y() are unusable. | 120 // y() are unusable. |
| 121 // FIXME: This should probably respect transforms. | 121 // FIXME: This should probably respect transforms. |
| 122 LayoutPoint absoluteThumbOrigin = | 122 LayoutPoint absoluteThumbOrigin = |
| 123 layoutBox()->absoluteBoundingBoxRectIgnoringTransforms().location(); | 123 layoutBox()->absoluteBoundingBoxRectIgnoringTransforms().location(); |
| 124 LayoutPoint absoluteSliderContentOrigin = | 124 LayoutPoint absoluteSliderContentOrigin = |
| 125 roundedLayoutPoint(input->layoutObject()->localToAbsolute()); | 125 LayoutPoint(input->layoutObject()->localToAbsolute()); |
| 126 IntRect trackBoundingBox = | 126 IntRect trackBoundingBox = |
| 127 trackElement->layoutObject()->absoluteBoundingBoxRectIgnoringTransforms(); | 127 trackElement->layoutObject()->absoluteBoundingBoxRectIgnoringTransforms(); |
| 128 IntRect inputBoundingBox = | 128 IntRect inputBoundingBox = |
| 129 input->layoutObject()->absoluteBoundingBoxRectIgnoringTransforms(); | 129 input->layoutObject()->absoluteBoundingBoxRectIgnoringTransforms(); |
| 130 if (isVertical) { | 130 if (isVertical) { |
| 131 trackSize = trackElement->layoutBox()->contentHeight() - | 131 trackSize = trackElement->layoutBox()->contentHeight() - |
| 132 layoutBox()->size().height(); | 132 layoutBox()->size().height(); |
| 133 position = offset.y() - layoutBox()->size().height() / 2 - | 133 position = offset.y() - layoutBox()->size().height() / 2 - |
| 134 trackBoundingBox.y() + inputBoundingBox.y() - | 134 trackBoundingBox.y() + inputBoundingBox.y() - |
| 135 layoutBox()->marginBottom(); | 135 layoutBox()->marginBottom(); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 updateTouchEventHandlerRegistry(); | 448 updateTouchEventHandlerRegistry(); |
| 449 HTMLElement::didMoveToNewDocument(oldDocument); | 449 HTMLElement::didMoveToNewDocument(oldDocument); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void SliderContainerElement::removeAllEventListeners() { | 452 void SliderContainerElement::removeAllEventListeners() { |
| 453 Node::removeAllEventListeners(); | 453 Node::removeAllEventListeners(); |
| 454 m_hasTouchEventHandler = false; | 454 m_hasTouchEventHandler = false; |
| 455 } | 455 } |
| 456 | 456 |
| 457 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |