Changeset 87372 in webkit
- Timestamp:
- May 26, 2011 2:58:25 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r87371 r87372 1 2011-05-26 Keishi Hattori <keishi@webkit.org> 2 3 Reviewed by Kent Tamura. 4 5 Add <input type=color> appearance. 6 https://bugs.webkit.org/show_bug.cgi?id=61275 7 8 * fast/forms/color/input-appearance-color.html: Added. Tests appearance of input type=color. 9 * platform/chromium/test_expectations.txt: Expect FAIL for fast/forms/color 10 * platform/mac/fast/forms/color/input-appearance-color-expected.png: Added. 11 * platform/mac/fast/forms/color/input-appearance-color-expected.txt: Added. 12 1 13 2011-05-26 Kent Tamura <tkent@chromium.org> 2 14 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r87354 r87372 4117 4117 4118 4118 // New tests added in r87274 4119 BUGCR83865 : fast/forms/color /input-value-sanitization-color.html= FAIL PASS4119 BUGCR83865 : fast/forms/color = FAIL PASS 4120 4120 4121 4121 // New tests added in webkit r87284 -
trunk/Source/WebCore/ChangeLog
r87371 r87372 1 2011-05-26 Keishi Hattori <keishi@webkit.org> 2 3 Reviewed by Kent Tamura. 4 5 Add <input type=color> appearance. 6 https://bugs.webkit.org/show_bug.cgi?id=61275 7 8 Test: fast/forms/color/input-appearance-color.html 9 10 * css/html.css: 11 (input[type="color"]): Adds square-button appearance. 12 (input[type="color"]::-webkit-color-swatch-wrapper): 13 (input[type="color"]::-webkit-color-swatch): 14 (input[type="color"][list]): Adds menulist appearance. 15 (input[type="color"][list]::-webkit-color-swatch-wrapper): 16 (input[type="color"][list]::-webkit-color-swatch): 17 * html/ColorInputType.cpp: 18 (WebCore::ColorInputType::createShadowSubtree): Creates -webkit-color-swatch inside -webkit-color-swatch-wrapper. 19 (WebCore::ColorInputType::updateColorSwatch): Updates background color of shadowColorSwatch. 20 (WebCore::ColorInputType::valueChanged): Calls updateColorSwatch. 21 (WebCore::ColorInputType::shadowColorSwatch): Gets shadowColorSwatch element. 22 * html/ColorInputType.h: 23 (WebCore::ColorInputType::ColorInputType): Changed to inherit InputType. 24 1 25 2011-05-26 Kent Tamura <tkent@chromium.org> 2 26 -
trunk/Source/WebCore/css/html.css
r87067 r87372 584 584 } 585 585 586 #if defined(ENABLE_INPUT_COLOR) && ENABLE_INPUT_COLOR 587 588 input[type="color"] { 589 -webkit-appearance: square-button; 590 width: 44px; 591 height: 23px; 592 } 593 594 input[type="color"]::-webkit-color-swatch-wrapper { 595 display:-webkit-box; 596 padding: 4px 2px; 597 -webkit-box-sizing: border-box; 598 width: 100%; 599 height: 100% 600 } 601 602 input[type="color"]::-webkit-color-swatch { 603 background-color: #000000; 604 border: 1px solid #777777; 605 -webkit-box-flex: 1; 606 } 607 608 #if defined(ENABLE_DATALIST) && ENABLE_DATALIST 609 610 input[type="color"][list] { 611 -webkit-appearance: menulist; 612 width: 88px; 613 height: 23px; 614 } 615 616 input[type="color"][list]::-webkit-color-swatch-wrapper { 617 padding-left: 8px; 618 padding-right: 24px; 619 } 620 621 input[type="color"][list]::-webkit-color-swatch { 622 border-color: #000000; 623 } 624 625 #endif // defined(ENABLE_DATALIST) && ENABLE_DATALIST 626 627 #endif // defined(ENABLE_INPUT_COLOR) && ENABLE_INPUT_COLOR 628 586 629 select { 587 630 -webkit-appearance: menulist; -
trunk/Source/WebCore/html/ColorInputType.cpp
r87274 r87372 33 33 34 34 #include "Color.h" 35 #include "ElementWithPseudoId.h" 35 36 #include "HTMLInputElement.h" 37 #include "ShadowRoot.h" 36 38 #include <wtf/PassOwnPtr.h> 37 39 #include <wtf/text/WTFString.h> … … 91 93 } 92 94 95 void ColorInputType::createShadowSubtree() 96 { 97 Document* document = element()->document(); 98 RefPtr<HTMLElement> wrapperElement = ElementWithPseudoId::create(document, "-webkit-color-swatch-wrapper"); 99 ExceptionCode ec = 0; 100 wrapperElement->appendChild(ElementWithPseudoId::create(document, "-webkit-color-swatch"), ec); 101 element()->ensureShadowRoot()->appendChild(wrapperElement.release(), ec); 102 103 updateColorSwatch(); 104 } 105 106 void ColorInputType::valueChanged() 107 { 108 updateColorSwatch(); 109 } 110 111 void ColorInputType::updateColorSwatch() 112 { 113 HTMLElement* colorSwatch = shadowColorSwatch(); 114 if (!colorSwatch) 115 return; 116 117 ExceptionCode ec; 118 colorSwatch->style()->setProperty("background-color", element()->value(), ec); 119 } 120 121 HTMLElement* ColorInputType::shadowColorSwatch() const 122 { 123 Node* shadow = element()->shadowRoot(); 124 return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0; 125 } 126 93 127 } // namespace WebCore 94 128 -
trunk/Source/WebCore/html/ColorInputType.h
r87274 r87372 38 38 namespace WebCore { 39 39 40 class ColorInputType : public BaseButtonInputType {40 class ColorInputType : public InputType { 41 41 public: 42 42 static PassOwnPtr<InputType> create(HTMLInputElement*); 43 43 44 44 private: 45 ColorInputType(HTMLInputElement* element) : BaseButtonInputType(element) { }45 ColorInputType(HTMLInputElement* element) : InputType(element) { } 46 46 virtual bool isColorControl() const; 47 47 virtual const AtomicString& formControlType() const; … … 49 49 virtual String fallbackValue(); 50 50 virtual String sanitizeValue(const String&); 51 virtual void createShadowSubtree(); 52 virtual void valueChanged(); 53 54 void updateColorSwatch(); 55 HTMLElement* shadowColorSwatch() const; 51 56 }; 52 57
Note: See TracChangeset
for help on using the changeset viewer.