+2006-11-15 Adele Peterson <adele@apple.com>
+
+ Reviewed by Adam.
+
+ Updating results for new slider implementation.
+
+ * fast/forms/input-appearance-height-expected.checksum:
+ * fast/forms/input-appearance-height-expected.png:
+ * fast/forms/input-appearance-height-expected.txt:
+
2006-11-14 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
-721026a78be45cde3030bc4390fe08d6
\ No newline at end of file
+e4bca3c6721f545a9f08bbf635fdc748
\ No newline at end of file
RenderBR {BR} at (58,119) size 0x0
RenderText {#text} at (0,127) size 39x18
text run at (0,127) width 39: "range "
- DeprecatedSlider {INPUT} at (41,126) size 129x15 [bgcolor=#FFFFFF]
+ RenderSlider {INPUT} at (41,126) size 129x15 [bgcolor=#FFFFFF]
RenderText {#text} at (172,127) size 4x18
text run at (172,127) width 4: " "
RenderBR {BR} at (176,141) size 0x0
RenderBlock {DIV} at (3,3) size 142x13
layer at (77,243) size 142x13
RenderBlock {DIV} at (3,3) size 142x13
+layer at (106,152) size 15x15
+ RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
+2006-11-15 Adele Peterson <adele@apple.com>
+
+ Reviewed by Adam.
+
+ New implementation of slider control.
+
+ * WebCore.xcodeproj/project.pbxproj: Removed DeprecatedSlider and Slider classes, added RenderSlider class.
+ * rendering/DeprecatedSlider.cpp: Removed.
+ * rendering/DeprecatedSlider.h: Removed.
+ * platform/Slider.h: Removed.
+ * platform/mac/SliderMac.mm: Removed.
+ * platform/win/TemporaryLinkStubs.cpp:
+
+ * css/CSSSelector.h: (WebCore::CSSSelector::): Added PseudoElement for thumb, PseudoSliderThumb.
+ * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Added code for "-webkit-slider-thumb".
+ * css/cssstyleselector.cpp: (WebCore::CSSStyleSelector::checkOneSelector):
+ * rendering/RenderStyle.cpp:
+ (WebCore::):
+ (WebCore::pseudoBit):
+ * rendering/RenderStyle.h: (WebCore::RenderStyle::):
+
+ * css/html4.css: Added style for input[type="range"] and input[type="range"]::-webkit-slider-thumb
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::createRenderer): Create RenderSlider for input type="range" elements.
+ (WebCore::HTMLInputElement::defaultEventHandler): Allow the renderer to forward events, and set thumb position when click occurs on the track.
+
+ * page/EventHandler.cpp: Added concept of a node that will capture all mouse events. This will be used by the slider thumb, so it can
+ continue to capture mouse move events during the drag, even though those events aren't directly over the slider.
+ (WebCore::EventHandler::EventHandler):
+ (WebCore::EventHandler::setCapturingMouseEventsNode):
+ (WebCore::EventHandler::dispatchMouseEvent): If the capturingMouseEventsNode is set, then dispatch all mouse events to that node.
+ * page/EventHandler.h:
+
+ * rendering/RenderSlider.cpp: Added.
+ (WebCore::HTMLSliderThumbElement::isShadowNode):
+ (WebCore::HTMLSliderThumbElement::shadowParentNode):
+ (WebCore::HTMLSliderThumbElement::inDragMode): Keeps track of whether or not the thumb is in drag mode.
+ (WebCore::HTMLSliderThumbElement::HTMLSliderThumbElement):
+ (WebCore::HTMLSliderThumbElement::defaultEventHandler): Handles positioning of slider thumb during drag.
+ (WebCore::RenderSlider::RenderSlider):
+ (WebCore::RenderSlider::~RenderSlider):
+ (WebCore::RenderSlider::baselinePosition):
+ (WebCore::RenderSlider::calcMinMaxWidth):
+ (WebCore::RenderSlider::setStyle):
+ (WebCore::RenderSlider::createThumbStyle):
+ (WebCore::RenderSlider::layout): Positions the thumb to be centered on the track.
+ (WebCore::RenderSlider::updateFromElement):
+ (WebCore::RenderSlider::mouseEventIsInThumb):
+ (WebCore::RenderSlider::setValueForPosition):
+ (WebCore::RenderSlider::setPositionFromValue):
+ (WebCore::RenderSlider::positionForOffset):
+ (WebCore::RenderSlider::valueChanged):
+ (WebCore::RenderSlider::currentPosition):
+ (WebCore::RenderSlider::setCurrentPosition):
+ (WebCore::RenderSlider::trackSize):
+ (WebCore::RenderSlider::forwardEvent):
+ (WebCore::RenderSlider::inDragMode):
+ * rendering/RenderSlider.h: Added.
+ (WebCore::RenderSlider::renderName):
+
+ * rendering/RenderTheme.cpp: Added drawing code for slider track and thumb.
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::paint):
+ (WebCore::RenderTheme::paintBorderOnly):
+ (WebCore::RenderTheme::paintDecorations):
+ (WebCore::RenderTheme::adjustSliderTrackStyle):
+ (WebCore::RenderTheme::adjustSliderThumbStyle):
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::paintSliderTrack):
+ (WebCore::RenderTheme::paintSliderThumb):
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::RenderThemeMac):
+ (WebCore::TrackGradientInterpolate):
+ (WebCore::RenderThemeMac::paintSliderTrack):
+ (WebCore::RenderThemeMac::paintSliderThumb):
+ (WebCore::RenderThemeMac::adjustSliderTrackStyle):
+ (WebCore::RenderThemeMac::adjustSliderThumbStyle):
+
2006-11-15 Beth Dakin <bdakin@apple.com>
Reviewed by Adam.
93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199CF08245E59001E9ABC /* AtomicStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3B364705C9D5E200E42902 /* AtomicStringList.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199DE08245E59001E9ABC /* Position.h in Headers */ = {isa = PBXBuildFile; fileRef = BE91FC8B06133666005E3790 /* Position.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 93F199E008245E59001E9ABC /* Slider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC86FB8D061F5C23006BB822 /* Slider.h */; };
93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; };
93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D90660B0665D937006B6F1A /* ClipboardMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */; };
93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */; };
93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */; };
93F19AF808245E59001E9ABC /* Position.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE91FC8C06133666005E3790 /* Position.cpp */; };
- 93F19AFA08245E59001E9ABC /* SliderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC86FB8E061F5C23006BB822 /* SliderMac.mm */; };
93F19AFD08245E59001E9ABC /* HTMLCanvasElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */; };
93F19AFF08245E59001E9ABC /* ClipboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D90660C0665D937006B6F1A /* ClipboardMac.mm */; };
93F19B0308245E59001E9ABC /* XSLStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06F24906D18A7E004A6FA3 /* XSLStyleSheet.cpp */; };
AB23A31309BBA7760067CC53 /* HTMLTextFieldInnerElement.h in Headers */ = {isa = PBXBuildFile; fileRef = AB23A31109BBA7760067CC53 /* HTMLTextFieldInnerElement.h */; };
AB23A32709BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB23A32509BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp */; };
AB23A32809BBA7D00067CC53 /* BeforeTextInsertedEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = AB23A32609BBA7D00067CC53 /* BeforeTextInsertedEvent.h */; };
+ AB247A6C0AFD6383003FA5FD /* RenderSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */; };
+ AB247A6D0AFD6383003FA5FD /* RenderSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = AB247A6B0AFD6383003FA5FD /* RenderSlider.h */; };
AB4261D80A2F6C9700BDD17D /* missingImage.tiff in Resources */ = {isa = PBXBuildFile; fileRef = AB4261D70A2F6C9700BDD17D /* missingImage.tiff */; };
AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */; };
AB67D1A9097F3AE300F9392E /* RenderTextControl.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextControl.h */; };
BC6DB3690A1A7CB700E5CD14 /* GlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DB3680A1A7CB700E5CD14 /* GlyphMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC6DB4740A1A90FB00E5CD14 /* GlyphMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4730A1A90FB00E5CD14 /* GlyphMap.cpp */; };
BC6DB4D40A1AFEEF00E5CD14 /* GlyphMapMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4D30A1AFEEF00E5CD14 /* GlyphMapMac.cpp */; };
- BC92F1DD0A40AEA300AC0746 /* DeprecatedSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */; };
- BC92F1DE0A40AEA300AC0746 /* DeprecatedSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC92F1DC0A40AEA300AC0746 /* DeprecatedSlider.h */; };
BC9C328B09933A6E001D6924 /* ImageAnimationObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9C328A09933A6D001D6924 /* ImageAnimationObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCAA90C30A7EBA60008B1229 /* ScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCAA90C20A7EBA60008B1229 /* ScrollBar.cpp */; };
BCB16B8B0979B01400467741 /* DeprecatedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16B880979B01400467741 /* DeprecatedArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
AB23A31109BBA7760067CC53 /* HTMLTextFieldInnerElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLTextFieldInnerElement.h; sourceTree = "<group>"; };
AB23A32509BBA7D00067CC53 /* BeforeTextInsertedEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BeforeTextInsertedEvent.cpp; sourceTree = "<group>"; };
AB23A32609BBA7D00067CC53 /* BeforeTextInsertedEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BeforeTextInsertedEvent.h; sourceTree = "<group>"; };
+ AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSlider.cpp; sourceTree = "<group>"; };
+ AB247A6B0AFD6383003FA5FD /* RenderSlider.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderSlider.h; sourceTree = "<group>"; };
AB4261D70A2F6C9700BDD17D /* missingImage.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = missingImage.tiff; sourceTree = "<group>"; };
AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControl.cpp; sourceTree = "<group>"; };
AB67D1A7097F3AE300F9392E /* RenderTextControl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderTextControl.h; sourceTree = "<group>"; };
BC6DB4D30A1AFEEF00E5CD14 /* GlyphMapMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphMapMac.cpp; sourceTree = "<group>"; };
BC7B2AF80450824100A8000F /* ScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBar.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformScrollBarMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- BC86FB8D061F5C23006BB822 /* Slider.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Slider.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- BC86FB8E061F5C23006BB822 /* SliderMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SliderMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedSlider.cpp; sourceTree = "<group>"; };
- BC92F1DC0A40AEA300AC0746 /* DeprecatedSlider.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DeprecatedSlider.h; sourceTree = "<group>"; };
BC9C328A09933A6D001D6924 /* ImageAnimationObserver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageAnimationObserver.h; sourceTree = "<group>"; };
BCAA90C20A7EBA60008B1229 /* ScrollBar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ScrollBar.cpp; path = platform/ScrollBar.cpp; sourceTree = SOURCE_ROOT; };
BCB16B880979B01400467741 /* DeprecatedArray.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DeprecatedArray.h; sourceTree = "<group>"; };
BCAA90C20A7EBA60008B1229 /* ScrollBar.cpp */,
9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */,
93309E9F099EB78C0056E581 /* SharedTimerMac.cpp */,
- BC86FB8E061F5C23006BB822 /* SliderMac.mm */,
4B3043C80AE0371D00A82647 /* SoundMac.mm */,
84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
93B0FD880A759BED0080AD44 /* StringImplMac.mm */,
BCFB2F40097A24B500BA703D /* SegmentedString.h */,
BCFB2E830979FD4F00BA703D /* Shared.h */,
93309EA0099EB78C0056E581 /* SharedTimer.h */,
- BC86FB8D061F5C23006BB822 /* Slider.h */,
4B3043C60AE0370300A82647 /* Sound.h */,
F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */,
9352071709BD3BA500F2038D /* StaticConstructors.h */,
F523D2F302DE443B018635CA /* rendering */ = {
isa = PBXGroup;
children = (
+ AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */,
+ AB247A6B0AFD6383003FA5FD /* RenderSlider.h */,
A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */,
A8CFF0490A154F09000A4234 /* AutoTableLayout.h */,
BCEA4813097D93020094C9E4 /* bidi.cpp */,
9392F1490AD1861300691BD4 /* CounterResetNode.cpp */,
9392F1450AD1860C00691BD4 /* CounterResetNode.h */,
BCEA4817097D93020094C9E4 /* DataRef.h */,
- BC92F1DB0A40AEA300AC0746 /* DeprecatedSlider.cpp */,
- BC92F1DC0A40AEA300AC0746 /* DeprecatedSlider.h */,
A8CFF6CA0A1561CD000A4234 /* EllipsisBox.cpp */,
A8CFF6BD0A156118000A4234 /* EllipsisBox.h */,
A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */,
93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */,
93F199CF08245E59001E9ABC /* AtomicStringList.h in Headers */,
93F199DE08245E59001E9ABC /* Position.h in Headers */,
- 93F199E008245E59001E9ABC /* Slider.h in Headers */,
93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */,
93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */,
93F199EC08245E59001E9ABC /* XSLStyleSheet.h in Headers */,
4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */,
1AC694C80A3B1676003F5049 /* PluginDocument.h in Headers */,
51D3EA170A3D24D300BADA35 /* SQLDatabase.h in Headers */,
- BC92F1DE0A40AEA300AC0746 /* DeprecatedSlider.h in Headers */,
D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */,
85031B3D0A44EFC700F992E0 /* BeforeUnloadEvent.h in Headers */,
85031B3E0A44EFC700F992E0 /* Clipboard.h in Headers */,
930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */,
14D823520AF92A790004F057 /* Chrome.h in Headers */,
14D824080AF93AEB0004F057 /* ChromeClient.h in Headers */,
+ AB247A6D0AFD6383003FA5FD /* RenderSlider.h in Headers */,
65DADA000AFD86BF00CE53ED /* FormDataStreamMac.h in Headers */,
65DADA180AFD878000CE53ED /* FormData.h in Headers */,
651888890AFF3BF700164720 /* ResourceError.h in Headers */,
93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */,
93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.mm in Sources */,
93F19AF808245E59001E9ABC /* Position.cpp in Sources */,
- 93F19AFA08245E59001E9ABC /* SliderMac.mm in Sources */,
93F19AFD08245E59001E9ABC /* HTMLCanvasElement.cpp in Sources */,
93F19AFF08245E59001E9ABC /* ClipboardMac.mm in Sources */,
93F19B0308245E59001E9ABC /* XSLStyleSheet.cpp in Sources */,
1AC694C70A3B1676003F5049 /* PluginDocument.cpp in Sources */,
51D3EA160A3D24D300BADA35 /* SQLDatabase.cpp in Sources */,
51D3EA180A3D24D300BADA35 /* SQLStatement.cpp in Sources */,
- BC92F1DD0A40AEA300AC0746 /* DeprecatedSlider.cpp in Sources */,
D05CED290A40BB2C00C5AF38 /* FormatBlockCommand.cpp in Sources */,
85031B3C0A44EFC700F992E0 /* BeforeUnloadEvent.cpp in Sources */,
85031B3F0A44EFC700F992E0 /* ClipboardEvent.cpp in Sources */,
B2A015B90AF6CD53006BCE0E /* SVGResourceMasker.cpp in Sources */,
B2EBDC9C0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp in Sources */,
14D8238B0AF92DF60004F057 /* Chrome.cpp in Sources */,
+ AB247A6C0AFD6383003FA5FD /* RenderSlider.cpp in Sources */,
1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */,
1402692D0AFE72D8005919E2 /* ScreenMac.mm in Sources */,
65DAD9FC0AFD86B400CE53ED /* FormData.cpp in Sources */,
static AtomicString onlyOfType("only-of-type");
static AtomicString root("root");
static AtomicString selection("selection");
+ static AtomicString sliderThumb("-webkit-slider-thumb");
static AtomicString target("target");
static AtomicString visited("visited");
bool element = false; // pseudo-element
else if (value == selection) {
_pseudoType = PseudoSelection;
element = true;
+ } else if (value == sliderThumb) {
+ _pseudoType = PseudoSliderThumb;
+ element = true;
} else if (value == target)
_pseudoType = PseudoTarget;
else if (value == visited)
PseudoNot,
PseudoRoot,
PseudoSelection,
- PseudoFileUploadButton
+ PseudoFileUploadButton,
+ PseudoSliderThumb
};
PseudoType pseudoType() const
case CSSSelector::PseudoFileUploadButton:
dynamicPseudo = RenderStyle::FILE_UPLOAD_BUTTON;
return true;
-
+ case CSSSelector::PseudoSliderThumb:
+ dynamicPseudo = RenderStyle::SLIDER_THUMB;
+ return true;
case CSSSelector::PseudoNotParsed:
assert(false);
break;
box-sizing: border-box
}
+input[type="range"] {
+ -webkit-appearance: slider-horizontal;
+ padding: initial;
+ border: initial;
+ -webkit-user-select: ignore;
+ margin: 2px;
+}
+
+input[type="range"]::-webkit-slider-thumb {
+ -webkit-appearance: sliderthumb-horizontal;
+ -webkit-user-select: ignore
+}
+
input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled, input[type="file"]::-webkit-file-upload-button:disabled, button:disabled, select:disabled, optgroup:disabled, option:disabled {
color: GrayText
}
#include "BeforeTextInsertedEvent.h"
#include "CSSPropertyNames.h"
-#include "DeprecatedSlider.h"
#include "Document.h"
#include "Event.h"
#include "EventHandler.h"
#include "RenderText.h"
#include "RenderTextControl.h"
#include "RenderTheme.h"
+#include "RenderSlider.h"
#include "SelectionController.h"
#include <unicode/ubrk.h>
case SEARCH:
return new (arena) RenderLineEdit(this);
case RANGE:
- return new (arena) DeprecatedSlider(this);
+ return new (arena) RenderSlider(this);
case ISINDEX:
case PASSWORD:
case TEXT:
if (isNonWidgetTextField() && (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent() || evt->type() == blurEvent) && renderer())
static_cast<RenderTextControl*>(renderer())->forwardEvent(evt);
-
+
+ if (inputType() == RANGE && renderer()) {
+ RenderSlider* slider = static_cast<RenderSlider*>(renderer());
+ if (evt->isMouseEvent() && evt->type() == mousedownEvent) {
+ MouseEvent* mEvt = static_cast<MouseEvent*>(evt);
+ if (!slider->mouseEventIsInThumb(mEvt)) {
+ slider->setValueForPosition(slider->positionForOffset(IntPoint(mEvt->offsetX(), mEvt->offsetY())));
+ }
+ }
+ if (evt->isMouseEvent() || evt->isDragEvent() || evt->isWheelEvent())
+ slider->forwardEvent(evt);
+ }
+
HTMLGenericFormElement::defaultEventHandler(evt);
}
, m_mouseDownMayStartAutoscroll(false)
, m_mouseDownMayStartDrag(false)
, m_resizeLayer(0)
+ , m_capturingMouseEventsNode(0)
, m_ignoreWheelEvents(false)
, m_clickCount(0)
, m_mouseDownWasInSubframe(false)
return m_nodeUnderMouse.get();
}
+void EventHandler::setCapturingMouseEventsNode(PassRefPtr<Node> n)
+{
+ m_capturingMouseEventsNode = n;
+}
+
bool EventHandler::advanceFocus(KeyboardEvent* event)
{
Document* document = m_frame->document();
targetNode = targetNode->parentNode();
if (targetNode)
targetNode = targetNode->shadowAncestorNode();
+
+ if (m_capturingMouseEventsNode)
+ targetNode = m_capturingMouseEventsNode.get();
+
m_nodeUnderMouse = targetNode;
// mouseout/mouseover
bool mousePressed() const { return m_mousePressed; }
void setMousePressed(bool pressed) { m_mousePressed = pressed; }
+ void setCapturingMouseEventsNode(PassRefPtr<Node>);
+
bool advanceFocus(KeyboardEvent*);
bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
RenderLayer* m_resizeLayer;
+ RefPtr<Node> m_capturingMouseEventsNode;
+
RefPtr<Node> m_nodeUnderMouse;
RefPtr<Node> m_lastNodeUnderMouse;
RefPtr<Frame> m_lastMouseMoveEventSubframe;
+++ /dev/null
-/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebCoreSlider_h
-#define WebCoreSlider_h
-
-#include "Widget.h"
-
-namespace WebCore {
-
-class Slider : public Widget {
-public:
- Slider();
- ~Slider();
-
- IntSize sizeHint() const;
- virtual void setFont(const Font&);
-
- void setValue(double);
- void setMinValue(double);
- void setMaxValue(double);
-
- double value() const;
- double minValue() const;
- double maxValue() const;
-
- void sliderValueChanged();
-
- const int* dimensions() const;
-
- virtual FocusPolicy focusPolicy() const;
-
-private:
- double m_minVal;
- double m_maxVal;
- double m_val;
-};
-
-}
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "Slider.h"
-
-#import "BlockExceptions.h"
-#import "EventHandler.h"
-#import "FrameMac.h"
-#import "KeyboardEvent.h"
-#import "TextField.h"
-#import "WebCoreFrameBridge.h"
-#import "WebCoreWidgetHolder.h"
-#import "WidgetClient.h"
-
-using namespace std;
-using namespace WebCore;
-
-@interface WebCoreSlider : NSSlider <WebCoreWidgetHolder>
-{
- Slider* slider;
- BOOL inNextValidKeyView;
-}
-
-- (id)initWithSlider:(Slider*)s;
-- (void)detachSlider;
-
-@end
-
-@implementation WebCoreSlider
-
-- (id)initWithSlider:(Slider*)s
-{
- self = [self init];
-
- slider = s;
-
- [self setTarget:self];
- [self setAction:@selector(slide:)];
- [self setContinuous:YES]; // Our sliders are always continuous by default.
- [self setMinValue:0.0];
- [self setMaxValue:100.0];
- [self setDoubleValue:50.0];
-
- return self;
-}
-
-- (void)detachSlider
-{
- [self setTarget:nil];
- slider = 0;
-}
-
-- (void)mouseDown:(NSEvent *)event
-{
- Widget::beforeMouseDown(self);
- [super mouseDown:event];
- Widget::afterMouseDown(self);
- if (slider)
- slider->sendConsumedMouseUp();
- if (slider && slider->client())
- slider->client()->clicked(slider);
-}
-
-- (IBAction)slide:(NSSlider*)sender
-{
- if (slider)
- slider->sliderValueChanged();
-}
-
-- (Widget *)widget
-{
- return slider;
-}
-
-// FIXME: All the firstResponder and keyView code here is replicated in KWQButton and
-// other KWQ classes. We should find a way to share this code.
-- (BOOL)becomeFirstResponder
-{
- BOOL become = [super becomeFirstResponder];
- if (become && slider && slider->client()) {
- if (!EventHandler::currentEventIsMouseDownInWidget(slider))
- slider->client()->scrollToVisible(slider);
- slider->client()->focusIn(slider);
- [FrameMac::bridgeForWidget(slider) formControlIsBecomingFirstResponder:self];
- }
- return become;
-}
-
-- (BOOL)resignFirstResponder
-{
- BOOL resign = [super resignFirstResponder];
- if (resign && slider && slider->client()) {
- slider->client()->focusOut(slider);
- [FrameMac::bridgeForWidget(slider) formControlIsResigningFirstResponder:self];
- }
- return resign;
-}
-
--(NSView *)nextKeyView
-{
- NSView *view = nil;
- if (slider && inNextValidKeyView) {
- // resign so we send a blur before setting focus on
- // the next widget, otherwise the blur for this
- // widget will remove focus from the widget after
- // we tab to it
- [self resignFirstResponder];
- if (slider)
- view = EventHandler::nextKeyView(slider, SelectingNext);
- else
- view = [super nextKeyView];
- } else {
- view = [super nextKeyView];
- }
- return view;
-}
-
--(NSView *)previousKeyView
-{
- NSView *view = nil;
- if (slider && inNextValidKeyView) {
- // resign so we send a blur before setting focus on
- // the next widget, otherwise the blur for this
- // widget will remove focus from the widget after
- // we tab to it
- [self resignFirstResponder];
- if (slider)
- view = EventHandler::nextKeyView(slider, SelectingPrevious);
- else
- view = [super previousKeyView];
- } else {
- view = [super previousKeyView];
- }
- return view;
-}
-
-- (BOOL)canBecomeKeyView
-{
- // Simplified method from NSView; overridden to replace NSView's way of checking
- // for full keyboard access with ours.
- if (slider) {
- Frame* frame = Frame::frameForWidget(slider);
- if (!frame->eventHandler()->tabsToAllControls(frame->eventHandler()->currentKeyboardEvent().get()))
- return NO;
- }
- return [self window] != nil && ![self isHiddenOrHasHiddenAncestor] && [self acceptsFirstResponder];
-}
-
--(NSView *)nextValidKeyView
-{
- inNextValidKeyView = YES;
- NSView *view = [super nextValidKeyView];
- inNextValidKeyView = NO;
- return view;
-}
-
--(NSView *)previousValidKeyView
-{
- inNextValidKeyView = YES;
- NSView *view = [super previousValidKeyView];
- inNextValidKeyView = NO;
- return view;
-}
-
-@end
-
-enum {
- dimWidth,
- dimHeight
-};
-
-Slider::Slider()
- : m_minVal(0.0), m_maxVal(100.0), m_val(50.0)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- WebCoreSlider* slider = [[WebCoreSlider alloc] initWithSlider:this];
- [[slider cell] setControlSize:NSSmallControlSize];
- setView(slider);
- [slider release];
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-Slider::~Slider()
-{
- WebCoreSlider* slider = (WebCoreSlider*)getView();
- [slider detachSlider];
-}
-
-void Slider::setFont(const Font& f)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- Widget::setFont(f);
-
- const NSControlSize size = ControlSizeForFont(f);
- NSControl * const slider = static_cast<NSControl *>(getView());
- [[slider cell] setControlSize:size];
- [slider setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:size]]];
-
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-Widget::FocusPolicy Slider::focusPolicy() const
-{
- Frame* frame = Frame::frameForWidget(this);
- if (!frame || !frame->eventHandler()->tabsToAllControls(frame->eventHandler()->currentKeyboardEvent().get()))
- return NoFocus;
- return Widget::focusPolicy();
-}
-
-IntSize Slider::sizeHint() const
-{
- return IntSize(dimensions()[dimWidth], dimensions()[dimHeight]);
-}
-
-void Slider::setValue(double v)
-{
- double val = max(m_minVal, min(v, m_maxVal));
-
- WebCoreSlider* slider = (WebCoreSlider*)getView();
- [slider setDoubleValue: val];
- m_val = val;
-}
-
-void Slider::setMinValue(double v)
-{
- if (v == m_minVal) return;
-
- WebCoreSlider* slider = (WebCoreSlider*)getView();
- [slider setMinValue: v];
- m_minVal = v;
-}
-
-void Slider::setMaxValue(double v)
-{
- if (v == m_maxVal) return;
-
- WebCoreSlider* slider = (WebCoreSlider*)getView();
- [slider setMaxValue: v];
- m_maxVal = v;
-}
-
-double Slider::value() const
-{
- return m_val;
-}
-
-double Slider::minValue() const
-{
- return m_minVal;
-}
-
-double Slider::maxValue() const
-{
- return m_maxVal;
-}
-
-void Slider::sliderValueChanged()
-{
- WebCoreSlider* slider = (WebCoreSlider*)getView();
- double v = [slider doubleValue];
- if (m_val != v) {
- m_val = v;
- if (client())
- client()->valueChanged(this);
- }
-}
-
-const int* Slider::dimensions() const
-{
- // We empirically determined these dimensions.
- // It would be better to get this info from AppKit somehow.
- static const int w[3][2] = {
- { 129, 21 },
- { 129, 15 },
- { 129, 12 },
- };
- NSControl * const slider = static_cast<NSControl *>(getView());
-
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return w[[[slider cell] controlSize]];
- END_BLOCK_OBJC_EXCEPTIONS;
-
- return w[NSSmallControlSize];
-}
#include "IntPoint.h"
#include "Widget.h"
#include "GraphicsContext.h"
-#include "Slider.h"
#include "Cursor.h"
#include "loader.h"
#include "FrameView.h"
void TextField::setMaxResults(int) { notImplemented(); }
bool TextField::edited() const { notImplemented(); return 0; }
-Slider::Slider() { notImplemented(); }
-Slider::~Slider() { notImplemented(); }
-IntSize Slider::sizeHint() const { notImplemented(); return IntSize(); }
-void Slider::setValue(double) { notImplemented(); }
-void Slider::setMaxValue(double) { notImplemented(); }
-void Slider::setMinValue(double) { notImplemented(); }
-void Slider::setFont(WebCore::Font const&) { notImplemented(); }
-double Slider::value() const { notImplemented(); return 0; }
-
FileChooser::FileChooser(Document*, RenderFileUploadControl*) { notImplemented(); }
FileChooser::~FileChooser() { notImplemented(); }
PassRefPtr<FileChooser> FileChooser::create(Document*, RenderFileUploadControl*) { notImplemented(); return 0; }
void FileChooser::disconnectUploadControl() { notImplemented(); }
void FileChooser::chooseFile(const String& filename) { notImplemented(); }
-Widget::FocusPolicy Slider::focusPolicy() const { notImplemented(); return NoFocus; }
Widget::FocusPolicy TextField::focusPolicy() const { notImplemented(); return NoFocus; }
PlatformMouseEvent::PlatformMouseEvent(const CurrentEventTag&) { notImplemented(); }
+++ /dev/null
-/*
- * This file is part of the DOM implementation for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "DeprecatedSlider.h"
-
-#include "EventNames.h"
-#include "HTMLInputElement.h"
-#include "HTMLNames.h"
-#include "Slider.h"
-
-using std::min;
-
-namespace WebCore {
-
-using namespace EventNames;
-using namespace HTMLNames;
-
-DeprecatedSlider::DeprecatedSlider(HTMLInputElement* element)
- : RenderFormElement(element)
-{
- setWidget(new Slider);
-}
-
-void DeprecatedSlider::calcMinMaxWidth()
-{
- ASSERT(!minMaxKnown());
-
- // Let the widget tell us how big it wants to be.
- IntSize s(widget()->sizeHint());
- bool widthSet = !style()->width().isAuto();
- bool heightSet = !style()->height().isAuto();
- if (heightSet && !widthSet) {
- // Flip the intrinsic dimensions.
- int barLength = s.width();
- s = IntSize(s.height(), barLength);
- }
- setIntrinsicWidth(s.width());
- setIntrinsicHeight(s.height());
-
- RenderFormElement::calcMinMaxWidth();
-}
-
-void DeprecatedSlider::updateFromElement()
-{
- String value = static_cast<HTMLInputElement*>(node())->value();
- const AtomicString& minStr = static_cast<HTMLInputElement*>(node())->getAttribute(minAttr);
- const AtomicString& maxStr = static_cast<HTMLInputElement*>(node())->getAttribute(maxAttr);
- const AtomicString& precision = static_cast<HTMLInputElement*>(node())->getAttribute(precisionAttr);
-
- double minVal = minStr.isNull() ? 0.0 : minStr.toDouble();
- double maxVal = maxStr.isNull() ? 100.0 : maxStr.toDouble();
- minVal = min(minVal, maxVal); // Make sure the range is sane.
-
- double val = value.isNull() ? (maxVal + minVal)/2.0 : value.toDouble();
- val = max(minVal, min(val, maxVal)); // Make sure val is within min/max.
-
- // Force integer value if not float.
- if (!equalIgnoringCase(precision, "float"))
- val = (int)(val + 0.5);
-
- static_cast<HTMLInputElement*>(node())->setValue(String::number(val));
-
- Slider* slider = static_cast<Slider*>(widget());
-
- slider->setMinValue(minVal);
- slider->setMaxValue(maxVal);
- slider->setValue(val);
-
- RenderFormElement::updateFromElement();
-}
-
-void DeprecatedSlider::valueChanged(Widget*)
-{
- Slider* slider = static_cast<Slider*>(widget());
-
- double val = slider->value();
- const AtomicString& precision = static_cast<HTMLInputElement*>(node())->getAttribute(precisionAttr);
-
- // Force integer value if not float.
- if (!equalIgnoringCase(precision, "float"))
- val = (int)(val + 0.5);
-
- static_cast<HTMLInputElement*>(node())->setValue(String::number(val));
-
- // Fire the "input" DOM event.
- static_cast<HTMLInputElement*>(node())->dispatchHTMLEvent(inputEvent, true, false);
-}
-
-} // namespace WebCore
+++ /dev/null
-/*
- * This file is part of the DOM implementation for KDE.
- *
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * (C) 1999 Antti Koivisto (koivisto@kde.org)
- * (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef DeprecatedSlider_h
-#define DeprecatedSlider_h
-
-#include "RenderFormElement.h"
-
-namespace WebCore {
-
- class HTMLInputElement;
-
- class DeprecatedSlider : public RenderFormElement {
- public:
- DeprecatedSlider(HTMLInputElement*);
-
- virtual const char* renderName() const { return "DeprecatedSlider"; }
-
- virtual void calcMinMaxWidth();
- virtual void updateFromElement();
-
- private:
- virtual void valueChanged(Widget*);
- };
-
-} // namespace WebCore
-
-#endif // DeprecatedSlider_h
--- /dev/null
+/**
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "RenderSlider.h"
+
+#include "CSSPropertyNames.h"
+#include "Event.h"
+#include "EventHandler.h"
+#include "EventNames.h"
+#include "Frame.h"
+#include "HTMLInputElement.h"
+#include "HTMLDivElement.h"
+#include "HTMLNames.h"
+#include "MouseEvent.h"
+
+using std::min;
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+class HTMLSliderThumbElement : public HTMLDivElement {
+public:
+ HTMLSliderThumbElement(Document*, Node* shadowParent = 0);
+
+ virtual void defaultEventHandler(Event*);
+ virtual bool isShadowNode() const { return true; }
+ virtual Node* shadowParentNode() { return m_shadowParent; }
+
+ bool inDragMode() const { return m_inDragMode; }
+private:
+ Node* m_shadowParent;
+ IntPoint m_initialClickPoint;
+ int m_initialPosition;
+ bool m_inDragMode;
+};
+
+HTMLSliderThumbElement::HTMLSliderThumbElement(Document* doc, Node* shadowParent)
+ : HTMLDivElement(doc)
+ , m_shadowParent(shadowParent)
+ , m_initialClickPoint(IntPoint())
+ , m_initialPosition(0)
+ , m_inDragMode(false)
+{
+}
+
+
+void HTMLSliderThumbElement::defaultEventHandler(Event* evt)
+{
+ if (evt->type() == mousedownEvent) {
+ MouseEvent* mEvt = static_cast<MouseEvent*>(evt);
+ if (renderer() && renderer()->parent() && static_cast<RenderSlider*>(renderer()->parent())->mouseEventIsInThumb(mEvt)) {
+ // Cache the initial point where the mouse down occurred.
+ m_initialClickPoint = IntPoint(mEvt->x(), mEvt->y());
+ // Cache the initial position of the thumb.
+ m_initialPosition = static_cast<RenderSlider*>(renderer()->parent())->currentPosition();
+ m_inDragMode = true;
+
+ document()->frame()->eventHandler()->setCapturingMouseEventsNode(this);
+
+ evt->setDefaultHandled();
+ }
+ } else if (evt->type() == mouseupEvent) {
+ m_initialClickPoint = IntPoint();
+ m_initialPosition = 0;
+ document()->frame()->eventHandler()->setCapturingMouseEventsNode(0);
+ m_inDragMode = false;
+
+ evt->setDefaultHandled();
+ } else if (evt->type() == mousemoveEvent) {
+ if (m_inDragMode && renderer() && renderer()->parent()) {
+ // Move the slider
+ MouseEvent* mEvt = static_cast<MouseEvent*>(evt);
+ RenderSlider* slider = static_cast<RenderSlider*>(renderer()->parent());
+
+ int newPosition = slider->positionForOffset(IntPoint(m_initialPosition + mEvt->x() - m_initialClickPoint.x() + (renderer()->absoluteBoundingBoxRect().width() / 2),
+ m_initialPosition + mEvt->y() - m_initialClickPoint.y() + (renderer()->absoluteBoundingBoxRect().height() / 2)));
+ if (slider->currentPosition() != newPosition)
+ slider->setCurrentPosition(newPosition);
+
+ slider->valueChanged();
+
+ evt->setDefaultHandled();
+ }
+ }
+}
+
+RenderSlider::RenderSlider(HTMLInputElement* element)
+ : RenderBlock(element)
+ , m_thumb(0)
+{
+}
+
+RenderSlider::~RenderSlider()
+{
+ if (m_thumb)
+ m_thumb->detach();
+}
+
+short RenderSlider::baselinePosition(bool b, bool isRootLineBox) const
+{
+ return height() + marginTop();
+}
+
+const int defaultTrackLength = 129;
+
+void RenderSlider::calcMinMaxWidth()
+{
+ m_minWidth = 0;
+ m_maxWidth = 0;
+
+ if (style()->width().isFixed() && style()->width().value() > 0)
+ m_minWidth = m_maxWidth = calcContentBoxWidth(style()->width().value());
+ else
+ m_maxWidth = defaultTrackLength;
+
+ if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
+ m_maxWidth = max(m_maxWidth, calcContentBoxWidth(style()->minWidth().value()));
+ m_minWidth = max(m_minWidth, calcContentBoxWidth(style()->minWidth().value()));
+ } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
+ m_minWidth = 0;
+ else
+ m_minWidth = m_maxWidth;
+
+ if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
+ m_maxWidth = min(m_maxWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ m_minWidth = min(m_minWidth, calcContentBoxWidth(style()->maxWidth().value()));
+ }
+
+ int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight();
+ m_minWidth += toAdd;
+ m_maxWidth += toAdd;
+
+ setMinMaxKnown();
+}
+
+void RenderSlider::setStyle(RenderStyle* newStyle)
+{
+ RenderBlock::setStyle(newStyle);
+
+ RenderStyle* thumbStyle = createThumbStyle(newStyle);
+ if (m_thumb)
+ m_thumb->renderer()->setStyle(thumbStyle);
+
+ if (newStyle->appearance() == SliderVerticalAppearance)
+ thumbStyle->setAppearance(SliderThumbVerticalAppearance);
+ else
+ thumbStyle->setAppearance(SliderThumbHorizontalAppearance);
+
+ setReplaced(isInline());
+}
+
+RenderStyle* RenderSlider::createThumbStyle(RenderStyle* parentStyle)
+{
+ RenderStyle* style = getPseudoStyle(RenderStyle::SLIDER_THUMB);
+ if (!style)
+ style = new (renderArena()) RenderStyle();
+
+ if (parentStyle)
+ style->inheritFrom(parentStyle);
+
+ style->setDisplay(BLOCK);
+ style->setPosition(RelativePosition);
+
+ return style;
+}
+
+void RenderSlider::layout()
+{
+ bool relayoutChildren = false;
+
+ if (m_thumb && m_thumb->renderer()) {
+ int oldWidth = m_width;
+ calcWidth();
+ int oldHeight = m_height;
+ calcHeight();
+
+ if (oldWidth != m_width || oldHeight != m_height)
+ relayoutChildren = true;
+
+ if (style()->appearance() == SliderVerticalAppearance)
+ m_thumb->renderer()->style()->setLeft(Length(m_width / 2 - m_thumb->renderer()->style()->width().value() / 2, Fixed));
+ else
+ m_thumb->renderer()->style()->setTop(Length(m_height / 2 - m_thumb->renderer()->style()->height().value() / 2, Fixed));
+
+ if (relayoutChildren)
+ setPositionFromValue(true);
+ }
+
+ RenderBlock::layoutBlock(relayoutChildren);
+}
+
+void RenderSlider::updateFromElement()
+{
+ if (!m_thumb) {
+ m_thumb = new HTMLSliderThumbElement(document(), node());
+ RenderStyle* thumbStyle = createThumbStyle(style());
+ m_thumb->setRenderer(m_thumb->createRenderer(renderArena(), thumbStyle));
+ m_thumb->renderer()->setStyle(thumbStyle);
+ m_thumb->setAttached();
+ m_thumb->setInDocument(true);
+ addChild(m_thumb->renderer());
+ }
+ setPositionFromValue();
+ setNeedsLayout(true);
+}
+
+bool RenderSlider::mouseEventIsInThumb(MouseEvent* evt)
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return false;
+
+ ASSERT(evt->target() == node());
+
+ IntRect thumbBounds = m_thumb->renderer()->absoluteBoundingBoxRect();
+ thumbBounds.setX(m_thumb->renderer()->style()->left().value());
+ thumbBounds.setY(m_thumb->renderer()->style()->top().value());
+
+ return thumbBounds.contains(evt->offsetX(), evt->offsetY());
+}
+
+void RenderSlider::setValueForPosition(int position)
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return;
+
+ const AtomicString& minStr = static_cast<HTMLInputElement*>(node())->getAttribute(minAttr);
+ const AtomicString& maxStr = static_cast<HTMLInputElement*>(node())->getAttribute(maxAttr);
+ const AtomicString& precision = static_cast<HTMLInputElement*>(node())->getAttribute(precisionAttr);
+
+ double minVal = minStr.isNull() ? 0.0 : minStr.toDouble();
+ double maxVal = maxStr.isNull() ? 100.0 : maxStr.toDouble();
+ minVal = min(minVal, maxVal); // Make sure the range is sane.
+
+ // Calculate the new value based on the position
+ double factor = (double)position / (double)trackSize();
+ if (style()->appearance() == SliderVerticalAppearance)
+ factor = 1.0 - factor;
+ double val = minVal + factor * (maxVal - minVal);
+
+ val = max(minVal, min(val, maxVal)); // Make sure val is within min/max.
+
+ // Force integer value if not float.
+ if (!equalIgnoringCase(precision, "float"))
+ val = (int)roundf(val);
+
+ static_cast<HTMLInputElement*>(node())->setValueFromRenderer(String::number(val));
+
+ if (position != currentPosition())
+ setCurrentPosition(position);
+}
+
+double RenderSlider::setPositionFromValue(bool inLayout)
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return 0;
+
+ if (!inLayout)
+ document()->updateLayout();
+
+ String value = static_cast<HTMLInputElement*>(node())->value();
+ const AtomicString& minStr = static_cast<HTMLInputElement*>(node())->getAttribute(minAttr);
+ const AtomicString& maxStr = static_cast<HTMLInputElement*>(node())->getAttribute(maxAttr);
+ const AtomicString& precision = static_cast<HTMLInputElement*>(node())->getAttribute(precisionAttr);
+
+ double minVal = minStr.isNull() ? 0.0 : minStr.toDouble();
+ double maxVal = maxStr.isNull() ? 100.0 : maxStr.toDouble();
+ minVal = min(minVal, maxVal); // Make sure the range is sane.
+
+ double oldVal = value.isNull() ? (maxVal + minVal)/2.0 : value.toDouble();
+ double val = max(minVal, min(oldVal, maxVal)); // Make sure val is within min/max.
+
+ // Force integer value if not float.
+ if (!equalIgnoringCase(precision, "float"))
+ val = (int)roundf(val);
+
+ // Calculate the new position based on the value
+ double factor = (val - minVal) / (maxVal - minVal);
+ if (style()->appearance() == SliderVerticalAppearance)
+ factor = 1.0 - factor;
+
+ setCurrentPosition(factor * trackSize());
+
+ if (val != oldVal)
+ static_cast<HTMLInputElement*>(node())->setValueFromRenderer(String::number(val));
+
+ return val;
+}
+
+int RenderSlider::positionForOffset(const IntPoint& p)
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return 0;
+
+ int position;
+ if (style()->appearance() == SliderVerticalAppearance) {
+ position = max(0, min(p.y() - (m_thumb->renderer()->absoluteBoundingBoxRect().height() / 2),
+ absoluteBoundingBoxRect().height() - m_thumb->renderer()->absoluteBoundingBoxRect().height()));
+ } else {
+ position = max(0, min(p.x() - (m_thumb->renderer()->absoluteBoundingBoxRect().width() / 2),
+ absoluteBoundingBoxRect().width() - m_thumb->renderer()->absoluteBoundingBoxRect().width()));
+ }
+ return position;
+}
+
+void RenderSlider::valueChanged()
+{
+ setValueForPosition(currentPosition());
+}
+
+int RenderSlider::currentPosition()
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return 0;
+
+ if (style()->appearance() == SliderVerticalAppearance)
+ return m_thumb->renderer()->style()->top().value();
+ return m_thumb->renderer()->style()->left().value();
+}
+
+void RenderSlider::setCurrentPosition(int pos)
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return;
+
+ if (style()->appearance() == SliderVerticalAppearance)
+ m_thumb->renderer()->style()->setTop(Length(pos, Fixed));
+ else
+ m_thumb->renderer()->style()->setLeft(Length(pos, Fixed));
+
+ repaint();
+ m_thumb->renderer()->repaint();
+}
+
+int RenderSlider::trackSize()
+{
+ if (!m_thumb || !m_thumb->renderer())
+ return 0;
+
+ if (style()->appearance() == SliderVerticalAppearance)
+ return absoluteBoundingBoxRect().height() - m_thumb->renderer()->absoluteBoundingBoxRect().height();
+ return absoluteBoundingBoxRect().width() - m_thumb->renderer()->absoluteBoundingBoxRect().width();
+}
+
+void RenderSlider::forwardEvent(Event* evt)
+{
+ m_thumb->defaultEventHandler(evt);
+}
+
+bool RenderSlider::inDragMode() const
+{
+ return m_thumb->inDragMode();
+}
+
+} // namespace WebCore
--- /dev/null
+/**
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderSlider_h
+#define RenderSlider_h
+
+#include "RenderBlock.h"
+
+namespace WebCore {
+
+ class HTMLDivElement;
+ class HTMLInputElement;
+ class HTMLSliderThumbElement;
+ class MouseEvent;
+
+ class RenderSlider : public RenderBlock {
+ public:
+ RenderSlider(HTMLInputElement*);
+ ~RenderSlider();
+
+ virtual const char* renderName() const { return "RenderSlider"; }
+
+ virtual short baselinePosition( bool, bool ) const;
+ virtual void calcMinMaxWidth();
+ virtual void setStyle(RenderStyle*);
+ virtual void layout();
+ virtual void updateFromElement();
+
+ bool mouseEventIsInThumb(MouseEvent*);
+
+ void setValueForPosition(int position);
+ double setPositionFromValue(bool inLayout = false);
+ int positionForOffset(const IntPoint&);
+
+ void valueChanged();
+
+ int currentPosition();
+ void setCurrentPosition(int pos);
+
+ void forwardEvent(Event*);
+ bool inDragMode() const;
+
+ private:
+ RenderStyle* createThumbStyle(RenderStyle* parentStyle);
+ int trackSize();
+
+ RefPtr<HTMLSliderThumbElement> m_thumb;
+};
+
+} // namespace WebCore
+
+#endif // RenderSlider_h
enum EPseudoBit { NO_BIT = 0x0, BEFORE_BIT = 0x1, AFTER_BIT = 0x2, FIRST_LINE_BIT = 0x4,
FIRST_LETTER_BIT = 0x8, SELECTION_BIT = 0x10, FIRST_LINE_INHERITED_BIT = 0x20,
- FILE_UPLOAD_BUTTON_BIT = 0x40 };
+ FILE_UPLOAD_BUTTON_BIT = 0x40, SLIDER_THUMB_BIT = 0x80 };
static inline int pseudoBit(RenderStyle::PseudoId pseudo)
{
return FIRST_LINE_INHERITED_BIT;
case RenderStyle::FILE_UPLOAD_BUTTON:
return FILE_UPLOAD_BUTTON_BIT;
+ /* case RenderStyle::SLIDER_TRACK:
+ return SLIDER_TRACK_BIT; */
+ case RenderStyle::SLIDER_THUMB:
+ return SLIDER_THUMB_BIT;
default:
return NO_BIT;
}
public:
// static pseudo styles. Dynamic ones are produced on the fly.
- enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, FILE_UPLOAD_BUTTON };
+ enum PseudoId { NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, FILE_UPLOAD_BUTTON, SLIDER_THUMB };
void ref() { m_ref++; }
void deref(RenderArena* arena) {
unsigned _page_break_before : 2; // EPageBreak
unsigned _page_break_after : 2; // EPageBreak
- unsigned _styleType : 3; // PseudoId
+ unsigned _styleType : 4; // PseudoId
bool _affectedByHover : 1;
bool _affectedByActive : 1;
bool _affectedByDrag : 1;
- unsigned _pseudoBits : 7;
+ unsigned _pseudoBits : 8;
unsigned _unicodeBidi : 2; // EUnicodeBidi
} noninherited_flags;
return adjustMenuListStyle(selector, style, e);
case MenulistButtonAppearance:
return adjustMenuListButtonStyle(selector, style, e);
+ case SliderHorizontalAppearance:
+ case SliderVerticalAppearance:
+ return adjustSliderTrackStyle(selector, style, e);
+ case SliderThumbHorizontalAppearance:
+ case SliderThumbVerticalAppearance:
+ return adjustSliderThumbStyle(selector, style, e);
default:
break;
}
return paintButton(o, paintInfo, r);
case MenulistAppearance:
return paintMenuList(o, paintInfo, r);
+ case SliderHorizontalAppearance:
+ case SliderVerticalAppearance:
+ return paintSliderTrack(o, paintInfo, r);
+ case SliderThumbHorizontalAppearance:
+ case SliderThumbVerticalAppearance:
+ return paintSliderThumb(o, paintInfo, r);
case MenulistButtonAppearance:
case TextFieldAppearance:
case TextAreaAppearance:
case SquareButtonAppearance:
case ButtonAppearance:
case MenulistAppearance:
+ case SliderHorizontalAppearance:
+ case SliderVerticalAppearance:
+ case SliderThumbHorizontalAppearance:
+ case SliderThumbVerticalAppearance:
default:
break;
}
case SquareButtonAppearance:
case ButtonAppearance:
case MenulistAppearance:
+ case SliderHorizontalAppearance:
+ case SliderVerticalAppearance:
+ case SliderThumbHorizontalAppearance:
+ case SliderThumbVerticalAppearance:
default:
break;
}
{
}
+void RenderTheme::adjustSliderTrackStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
+{
+}
+
+void RenderTheme::adjustSliderThumbStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
+{
+}
+
}
virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
+
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
};
// Function to obtain the theme. This is implemented in your platform-specific theme implementation to hand
virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
private:
IntRect inflateRect(const IntRect&, const IntSize&, const int* margins) const;
NSButtonCell* checkbox;
NSButtonCell* radio;
NSButtonCell* button;
+ NSSliderCell* sliderThumbHorizontalCell;
+ NSSliderCell* sliderThumbVerticalCell;
+ bool sliderHorizontalCellIsPressed;
+ bool sliderVerticalCellIsPressed;
NSPopUpButtonCell* popupButton;
Image* resizeCornerImage;
};
#import "cssstyleselector.h"
#import "CSSValueKeywords.h"
#import "Document.h"
+#import "Element.h"
#import "FoundationExtras.h"
#import "FrameView.h"
#import "GraphicsContext.h"
#import "Image.h"
#import "LocalCurrentGraphicsContext.h"
+#import "RenderSlider.h"
#import "RenderView.h"
#import "WebCoreSystemInterface.h"
+#import <Cocoa/Cocoa.h>
+
// The methods in this file are specific to the Mac OS X platform.
namespace WebCore {
: checkbox(nil)
, radio(nil)
, button(nil)
+ , sliderThumbHorizontalCell(nil)
+ , sliderThumbVerticalCell(nil)
+ , sliderHorizontalCellIsPressed(false)
+ , sliderVerticalCellIsPressed(false)
, resizeCornerImage(0)
{
}
outData[i] = ( 1.0 - a ) * dark[i] + a * light[i];
}
+static void TrackGradientInterpolate( void *info, const CGFloat *inData, CGFloat *outData )
+{
+ static float dark[4] = { 0, 0, 0, 0.678 };
+ static float light[4] = { 0, 0, 0, 0.13 };
+ float a = inData[0];
+ int i = 0;
+ for( i = 0; i < 4; i++ )
+ outData[i] = ( 1.0 - a ) * dark[i] + a * light[i];
+}
+
void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
CGContextRef context = paintInfo.context->platformContext();
return 0;
}
+const int trackWidth = 5;
+const int trackRadius = 2;
+
+bool RenderThemeMac::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ IntRect bounds = r;
+
+ if (o->style()->appearance() == SliderHorizontalAppearance) {
+ bounds.setHeight(trackWidth);
+ bounds.setY(r.y() + r.height() / 2 - trackWidth / 2);
+ } else if (o->style()->appearance() == SliderVerticalAppearance) {
+ bounds.setWidth(trackWidth);
+ bounds.setX(r.x() + r.width() / 2 - trackWidth / 2);
+ }
+
+ LocalCurrentGraphicsContext LocalCurrentGraphicsContext(paintInfo.context);
+ CGContextRef context = paintInfo.context->platformContext();
+ CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
+
+ paintInfo.context->save();
+ CGContextClipToRect(context, bounds);
+
+ struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
+ CGFunctionRef mainFunction = CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks);
+ CGShadingRef mainShading;
+ if (o->style()->appearance() == SliderVerticalAppearance) {
+ mainShading = CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()),
+ CGPointMake(bounds.right(), bounds.bottom()), mainFunction, false, false);
+ } else {
+ mainShading = CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()),
+ CGPointMake(bounds.x(), bounds.bottom()), mainFunction, false, false);
+ }
+
+ IntSize radius(trackRadius, trackRadius);
+ paintInfo.context->addRoundedRectClip(bounds,
+ radius, radius,
+ radius, radius);
+ CGContextDrawShading(context, mainShading);
+ paintInfo.context->restore();
+
+ return false;
+}
+
+const float verticalSliderHeightPadding = 0.1;
+
+bool RenderThemeMac::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ NSSliderCell* sliderThumbCell;
+ if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ sliderThumbCell = sliderThumbVerticalCell;
+ else
+ sliderThumbCell = sliderThumbHorizontalCell;
+
+ LocalCurrentGraphicsContext LocalCurrentGraphicsContext(paintInfo.context);
+
+ // Determine the width and height needed for the control and prepare the cell for painting.
+ if (!sliderThumbCell) {
+ sliderThumbCell = HardRetainWithNSRelease([[NSSliderCell alloc] init]);
+ [sliderThumbCell setTitle:nil];
+ [sliderThumbCell setSliderType:NSLinearSlider];
+ if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ sliderVerticalCellIsPressed = false;
+ else
+ sliderHorizontalCellIsPressed = false;
+ }
+ [sliderThumbCell setControlSize:NSSmallControlSize];
+
+ // Update the various states we respond to.
+ updateEnabledState(sliderThumbCell, o->parent());
+ updateFocusedState(sliderThumbCell, o->parent());
+
+ // Update the pressed state using the NSCell tracking methods, since that's how NSSliderCell keeps track of it.
+ bool oldPressed;
+ if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ oldPressed = sliderVerticalCellIsPressed;
+ else
+ oldPressed = sliderHorizontalCellIsPressed;
+
+ bool pressed = static_cast<RenderSlider*>(o->parent())->inDragMode();
+
+ if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ sliderVerticalCellIsPressed = pressed;
+ else
+ sliderHorizontalCellIsPressed = pressed;
+
+ if (pressed != oldPressed) {
+ if (pressed)
+ [sliderThumbCell startTrackingAt:NSPoint() inView:nil];
+ else
+ [sliderThumbCell stopTracking:NSPoint() at:NSPoint() inView:nil mouseIsUp:YES];
+ }
+
+ FloatRect bounds = r;
+ // Make the height of the vertical slider slightly larger so NSSliderCell will draw a vertical slider.
+ if (o->style()->appearance() == SliderThumbVerticalAppearance)
+ bounds.setHeight(bounds.height() + verticalSliderHeightPadding);
+
+ [sliderThumbCell drawWithFrame:NSRect(bounds) inView:o->view()->frameView()->getDocumentView()];
+ [sliderThumbCell setControlView:nil];
+
+ return false;
+}
+
+void RenderThemeMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element* e) const
+{
+}
+
+const int sliderThumbWidth = 15;
+const int sliderThumbHeight = 15;
+
+void RenderThemeMac::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element* e) const
+{
+ style->setWidth(Length(sliderThumbWidth, Fixed));
+ style->setHeight(Length(sliderThumbHeight, Fixed));
+}
+
}