Initial support for HTMLMeterElement
authoryael.aharon@nokia.com <yael.aharon@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 May 2010 16:41:06 +0000 (16:41 +0000)
committeryael.aharon@nokia.com <yael.aharon@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 May 2010 16:41:06 +0000 (16:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=38140

Reviewed by Kent Tamura.

WebCore:

This patch adds support for HTMLMeterElement, including default rendering
of the meter element. That is because some platforms do not have a native gauge.
The feature is turned on only for the Qt platform.

Tests: fast/dom/HTMLMeterElement/meter-element.html
       fast/dom/HTMLMeterElement/set-meter-properties.html

* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* css/CSSValueKeywords.in:
* css/html.css:
(meter):
(meter::-webkit-meter):
* html/HTMLAttributeNames.in:
* html/HTMLElement.cpp:
(WebCore::inlineTagList):
* html/HTMLElementsAllInOne.cpp:
* html/HTMLMeterElement.cpp: Added.
(WebCore::HTMLMeterElement::HTMLMeterElement):
(WebCore::HTMLMeterElement::create):
(WebCore::HTMLMeterElement::createRenderer):
(WebCore::HTMLMeterElement::formControlType):
(WebCore::HTMLMeterElement::parseMappedAttribute):
(WebCore::HTMLMeterElement::min):
(WebCore::HTMLMeterElement::setMin):
(WebCore::HTMLMeterElement::max):
(WebCore::HTMLMeterElement::setMax):
(WebCore::HTMLMeterElement::value):
(WebCore::HTMLMeterElement::setValue):
(WebCore::HTMLMeterElement::low):
(WebCore::HTMLMeterElement::setLow):
(WebCore::HTMLMeterElement::high):
(WebCore::HTMLMeterElement::setHigh):
(WebCore::HTMLMeterElement::optimum):
(WebCore::HTMLMeterElement::setOptimum):
* html/HTMLMeterElement.h: Added.
(WebCore::HTMLMeterElement::recalcWillValidate):
* html/HTMLMeterElement.idl: Added.
* html/HTMLTagNames.in:
* page/DOMWindow.idl:
* platform/ThemeTypes.h:
* rendering/RenderMeter.cpp: Added.
(WebCore::RenderMeter::RenderMeter):
(WebCore::RenderMeter::layout):
(WebCore::RenderMeter::updateFromElement):
* rendering/RenderMeter.h: Added.
(WebCore::RenderMeter::renderName):
(WebCore::RenderMeter::isMeter):
(WebCore::toRenderMeter):
* rendering/RenderObject.h:
(WebCore::RenderObject::isMeter):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::paintBorderOnly):
(WebCore::RenderTheme::paintDecorations):
(WebCore::RenderTheme::adjustMeterStyle):
(WebCore::RenderTheme::paintMeter):
* rendering/RenderTheme.h:

LayoutTests:

* fast/dom/HTMLMeterElement: Added.
* fast/dom/HTMLMeterElement/meter-element.html: Added.
* fast/dom/HTMLMeterElement/script-tests: Added.
* fast/dom/HTMLMeterElement/script-tests/TEMPLATE.html: Added.
* fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js: Added.
* fast/dom/HTMLMeterElement/set-meter-properties-expected.txt: Added.
* fast/dom/HTMLMeterElement/set-meter-properties.html: Added.
* platform/chromium/test_expectations.txt:
* platform/gtk/Skipped:
* platform/mac/Skipped:
* platform/qt/fast/dom/HTMLMeterElement: Added.
* platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.checksum: Added.
* platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.png: Added.
* platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.txt: Added.
* platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59541 268f45cc-cd09-0410-ab3c-d52691b4dbfc

39 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLMeterElement/meter-element.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLMeterElement/script-tests/TEMPLATE.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js [new file with mode: 0644]
LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.checksum [new file with mode: 0644]
LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.png [new file with mode: 0644]
LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/DerivedSources.cpp
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pri
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/CSSPrimitiveValueMappings.h
WebCore/css/CSSValueKeywords.in
WebCore/css/html.css
WebCore/html/HTMLAttributeNames.in
WebCore/html/HTMLElement.cpp
WebCore/html/HTMLElementsAllInOne.cpp
WebCore/html/HTMLMeterElement.cpp [new file with mode: 0644]
WebCore/html/HTMLMeterElement.h [new file with mode: 0644]
WebCore/html/HTMLMeterElement.idl [new file with mode: 0644]
WebCore/html/HTMLTagNames.in
WebCore/page/DOMWindow.idl
WebCore/platform/ThemeTypes.h
WebCore/rendering/RenderMeter.cpp [new file with mode: 0644]
WebCore/rendering/RenderMeter.h [new file with mode: 0644]
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderTheme.cpp
WebCore/rendering/RenderTheme.h

index 3cb00e1..eacf0eb 100644 (file)
@@ -1,3 +1,26 @@
+2010-05-15  Yael Aharon  <yael.aharon@nokia.com>
+
+        Reviewed by Kent Tamura.
+
+        Initial support for HTMLMeterElement
+        https://bugs.webkit.org/show_bug.cgi?id=38140
+
+        * fast/dom/HTMLMeterElement: Added.
+        * fast/dom/HTMLMeterElement/meter-element.html: Added.
+        * fast/dom/HTMLMeterElement/script-tests: Added.
+        * fast/dom/HTMLMeterElement/script-tests/TEMPLATE.html: Added.
+        * fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js: Added.
+        * fast/dom/HTMLMeterElement/set-meter-properties-expected.txt: Added.
+        * fast/dom/HTMLMeterElement/set-meter-properties.html: Added.
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/fast/dom/HTMLMeterElement: Added.
+        * platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.checksum: Added.
+        * platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.png: Added.
+        * platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.txt: Added.
+        * platform/win/Skipped:
+
 2010-05-15  Eric Uhrhane  <ericu@chromium.org>
 
         Reviewed by Dmitry Titov.
diff --git a/LayoutTests/fast/dom/HTMLMeterElement/meter-element.html b/LayoutTests/fast/dom/HTMLMeterElement/meter-element.html
new file mode 100644 (file)
index 0000000..5e864c8
--- /dev/null
@@ -0,0 +1 @@
+<html><body><meter min=10 value=30 max=100>30%</meter><meter min=0 value=70 max=100 style="width:10px; height:60px;">70%</meter></body></html>
diff --git a/LayoutTests/fast/dom/HTMLMeterElement/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/HTMLMeterElement/script-tests/TEMPLATE.html
new file mode 100644 (file)
index 0000000..1951c43
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js b/LayoutTests/fast/dom/HTMLMeterElement/script-tests/set-meter-properties.js
new file mode 100644 (file)
index 0000000..08bcd83
--- /dev/null
@@ -0,0 +1,130 @@
+description('Test setting valid and invalid properties of HTMLMeterElement.');
+
+var m = document.createElement('meter');
+
+debug("Test values before properties were set");
+shouldBe("m.min", "0");
+shouldBe("m.value", "0");
+shouldBe("m.max", "1");
+shouldBe("m.low", "0");
+shouldBe("m.high", "1");
+shouldBe("m.optimum", "0.5");
+
+debug("Set valid values");
+m.min = "-10";
+m.value = 7e1;
+m.max = "1e2";
+m.low = "10.1";
+m.high = "99.5";
+m.optimum = "70";
+shouldBe("m.min", "-10");
+shouldBe("m.value", "70");
+shouldBe("m.max", "100");
+shouldBe("m.low", "10.1");
+shouldBe("m.high", "99.5");
+shouldBe("m.optimum", "70");
+
+debug("Set attributes to improper values - 1");
+m.min = -10;
+m.value = 200;
+m.max = 100.0;
+m.low = 200;
+m.high = -50;
+m.optimum = null;
+shouldBe("m.min", "-10");
+shouldBe("m.value", "100");
+shouldBe("m.max", "100");
+shouldBe("m.low", "100");
+shouldBe("m.high", "100");
+shouldBe("m.optimum", "0");
+
+debug("Set attributes to improper values - 2");
+m.min = 200.0;
+m.value = -200.0;
+m.max = 0;
+m.low = null;
+shouldBe("m.min", "200.0");
+shouldBe("m.value", "200.0");
+shouldBe("m.max", "200.0");
+shouldBe("m.low", "200.0");
+
+debug("Set attributes to improper values - 3");
+m.min = 100.0;
+m.value = 200.0;
+m.max = 50;
+m.low = 10;
+m.high = 15e1;
+m.optimum = 12.5;
+shouldBe("m.min", "100.0");
+shouldBe("m.value", "100.0");
+shouldBe("m.max", "100.0");
+shouldBe("m.low", "100.0");
+shouldBe("m.high", "100.0");
+shouldBe("m.optimum", "100.0");
+
+debug("Set attributes to improper values - 4");
+m.min = 0.0;
+m.value = 250.0;
+m.max = 200;
+m.low = -10;
+m.high = 15e2;
+m.optimum = 12.5;
+shouldBe("m.min", "0.0");
+shouldBe("m.value", "200.0");
+shouldBe("m.max", "200.0");
+shouldBe("m.low", "0.0");
+shouldBe("m.high", "200.0");
+shouldBe("m.optimum", "12.5");
+
+debug("Set value to invalid value");
+shouldThrow('m.value = "value";', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+debug("Set min to NaN");
+shouldThrow('m.min = NaN;', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+debug("Set max to Infinity");
+shouldThrow('m.max = Infinity;', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+debug("Set low to invalid value");
+shouldThrow('m.low = "low";', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+debug("Set high to NaN");
+shouldThrow('m.high = NaN;', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+debug("Set optimum to Infinity");
+shouldThrow('m.optimum = Infinity;', '"Error: NOT_SUPPORTED_ERR: DOM Exception 9"');
+
+debug("Set attributes to valid numbers");
+m.setAttribute("min", 0);
+m.setAttribute("value", 5);
+m.setAttribute("max", 10);
+shouldBe("m.value", "5");
+shouldBe("m.max", "10");
+shouldBe("parseInt(m.getAttribute('value'))", "5");
+shouldBe("parseInt(m.getAttribute('max'))", "10");
+
+debug("Set attributes to invalid values");
+m.setAttribute("value", "ABC");
+m.setAttribute("max", "#");
+shouldBe("m.value", "0");
+shouldBe("m.max", "1");
+shouldBe("m.getAttribute('value')", "'ABC'");
+shouldBe("m.getAttribute('max')", "'#'");
+
+debug("Set attributes to numbers with leading spaces");
+m.setAttribute("value", " 5");
+m.setAttribute("min", " 5");
+m.setAttribute("max", " 5");
+m.setAttribute("low", " 5");
+m.setAttribute("high", " 5");
+m.setAttribute("optimum", " 5");
+shouldBe("m.value", "0");
+shouldBe("m.min", "0");
+shouldBe("m.max", "1");
+shouldBe("m.low", "0");
+shouldBe("m.high", "1");
+shouldBe("m.optimum", "0.5");
+
+
+var successfullyParsed = true;
+
diff --git a/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt b/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt
new file mode 100644 (file)
index 0000000..c3a7a72
--- /dev/null
@@ -0,0 +1,78 @@
+Test setting valid and invalid properties of HTMLMeterElement.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test values before properties were set
+PASS m.min is 0
+PASS m.value is 0
+PASS m.max is 1
+PASS m.low is 0
+PASS m.high is 1
+PASS m.optimum is 0.5
+Set valid values
+PASS m.min is -10
+PASS m.value is 70
+PASS m.max is 100
+PASS m.low is 10.1
+PASS m.high is 99.5
+PASS m.optimum is 70
+Set attributes to improper values - 1
+PASS m.min is -10
+PASS m.value is 100
+PASS m.max is 100
+PASS m.low is 100
+PASS m.high is 100
+PASS m.optimum is 0
+Set attributes to improper values - 2
+PASS m.min is 200.0
+PASS m.value is 200.0
+PASS m.max is 200.0
+PASS m.low is 200.0
+Set attributes to improper values - 3
+PASS m.min is 100.0
+PASS m.value is 100.0
+PASS m.max is 100.0
+PASS m.low is 100.0
+PASS m.high is 100.0
+PASS m.optimum is 100.0
+Set attributes to improper values - 4
+PASS m.min is 0.0
+PASS m.value is 200.0
+PASS m.max is 200.0
+PASS m.low is 0.0
+PASS m.high is 200.0
+PASS m.optimum is 12.5
+Set value to invalid value
+PASS m.value = "value"; threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Set min to NaN
+PASS m.min = NaN; threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Set max to Infinity
+PASS m.max = Infinity; threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Set low to invalid value
+PASS m.low = "low"; threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Set high to NaN
+PASS m.high = NaN; threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Set optimum to Infinity
+PASS m.optimum = Infinity; threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+Set attributes to valid numbers
+PASS m.value is 5
+PASS m.max is 10
+PASS parseInt(m.getAttribute('value')) is 5
+PASS parseInt(m.getAttribute('max')) is 10
+Set attributes to invalid values
+PASS m.value is 0
+PASS m.max is 1
+PASS m.getAttribute('value') is 'ABC'
+PASS m.getAttribute('max') is '#'
+Set attributes to numbers with leading spaces
+PASS m.value is 0
+PASS m.min is 0
+PASS m.max is 1
+PASS m.low is 0
+PASS m.high is 1
+PASS m.optimum is 0.5
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html b/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html
new file mode 100644 (file)
index 0000000..2f00801
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/set-meter-properties.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
index 64196e0..833d9ac 100644 (file)
@@ -2626,6 +2626,10 @@ BUG38227 DEFER : fast/dom/HTMLProgressElement/progress-element.html = MISSING
 BUG38227 DEFER : fast/dom/HTMLProgressElement/set-progress-properties.html = TEXT
 BUG38227 SKIP : fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html = FAIL
 
+// HTMLMeterElement related tests deferred due to https://bugs.webkit.org/show_bug.cgi?id=37074.
+BUGWK37074 DEFER : fast/dom/HTMLMeterElement/meter-element.html = MISSING
+BUGWK37074 DEFER : fast/dom/HTMLMeterElement/set-meter-properties.html = TEXT
+
 // WebKit roll 56004 -> 56026
 BUG38278 : fast/events/continuous-platform-wheelevent-in-scrolling-div.html = TIMEOUT
 BUG38278 : fast/events/platform-wheelevent-in-scrolling-div.html = TIMEOUT
index 18c7987..a5aee9e 100644 (file)
@@ -5714,6 +5714,10 @@ fast/dom/HTMLProgressElement/progress-element.html
 fast/dom/HTMLProgressElement/set-progress-properties.html
 fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html
 
+# meter element is not supported
+fast/dom/HTMLMeterElement/meter-element.html
+fast/dom/HTMLMeterElement/set-meter-properties.html
+
 # Needs mock support, and build slave Geolocation service
 # See https://bugs.webkit.org/show_bug.cgi?id=36053
 fast/dom/Geolocation/maximum-age.html
index 6126d44..7e70007 100644 (file)
@@ -142,6 +142,10 @@ fast/forms/multiple-form-submission-protection-mouse.html
 # The animation causes the result of this test to depend on the speed of executing it, and that will cause it to be flaky
 fast/dom/HTMLProgressElement/progress-element.html
 
+# meter element is not supported
+fast/dom/HTMLMeterElement/meter-element.html
+fast/dom/HTMLMeterElement/set-meter-properties.html
+
 # event.dataTransfer.setData('text/uri-list') not correctly implemented on Mac
 editing/pasteboard/dataTransfer-setData-getData.html
 
diff --git a/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.checksum b/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.checksum
new file mode 100644 (file)
index 0000000..c5fc561
--- /dev/null
@@ -0,0 +1 @@
+22dbcc8ef6e004c22aaecf5ea7126527
\ No newline at end of file
diff --git a/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.png b/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.png
new file mode 100644 (file)
index 0000000..b04a707
Binary files /dev/null and b/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.png differ
diff --git a/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.txt b/LayoutTests/platform/qt/fast/dom/HTMLMeterElement/meter-element-expected.txt
new file mode 100644 (file)
index 0000000..9ad245b
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderMeter {METER} at (0,44) size 80x16
+        RenderText {#text} at (0,0) size 0x0
+      RenderMeter {METER} at (80,0) size 10x60
+        RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
index e22c536..f10110c 100644 (file)
@@ -834,6 +834,10 @@ fast/dom/HTMLProgressElement/progress-element.html
 fast/dom/HTMLProgressElement/set-progress-properties.html
 fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html
 
+# meter element is not supported
+fast/dom/HTMLMeterElement/meter-element.html
+fast/dom/HTMLMeterElement/set-meter-properties.html
+
 # No Widgets 1.0 support
 fast/media/media-feature-wgt-view-mode.html
 
index 413504b..3443321 100644 (file)
@@ -1,3 +1,77 @@
+2010-05-15  Yael Aharon  <yael.aharon@nokia.com>
+
+        Reviewed by Kent Tamura.
+
+        Initial support for HTMLMeterElement
+        https://bugs.webkit.org/show_bug.cgi?id=38140
+
+        This patch adds support for HTMLMeterElement, including default rendering
+        of the meter element. That is because some platforms do not have a native gauge.
+        The feature is turned on only for the Qt platform.
+
+        Tests: fast/dom/HTMLMeterElement/meter-element.html
+               fast/dom/HTMLMeterElement/set-meter-properties.html
+
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pri:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        * css/CSSValueKeywords.in:
+        * css/html.css:
+        (meter):
+        (meter::-webkit-meter):
+        * html/HTMLAttributeNames.in:
+        * html/HTMLElement.cpp:
+        (WebCore::inlineTagList):
+        * html/HTMLElementsAllInOne.cpp:
+        * html/HTMLMeterElement.cpp: Added.
+        (WebCore::HTMLMeterElement::HTMLMeterElement):
+        (WebCore::HTMLMeterElement::create):
+        (WebCore::HTMLMeterElement::createRenderer):
+        (WebCore::HTMLMeterElement::formControlType):
+        (WebCore::HTMLMeterElement::parseMappedAttribute):
+        (WebCore::HTMLMeterElement::min):
+        (WebCore::HTMLMeterElement::setMin):
+        (WebCore::HTMLMeterElement::max):
+        (WebCore::HTMLMeterElement::setMax):
+        (WebCore::HTMLMeterElement::value):
+        (WebCore::HTMLMeterElement::setValue):
+        (WebCore::HTMLMeterElement::low):
+        (WebCore::HTMLMeterElement::setLow):
+        (WebCore::HTMLMeterElement::high):
+        (WebCore::HTMLMeterElement::setHigh):
+        (WebCore::HTMLMeterElement::optimum):
+        (WebCore::HTMLMeterElement::setOptimum):
+        * html/HTMLMeterElement.h: Added.
+        (WebCore::HTMLMeterElement::recalcWillValidate):
+        * html/HTMLMeterElement.idl: Added.
+        * html/HTMLTagNames.in:
+        * page/DOMWindow.idl:
+        * platform/ThemeTypes.h:
+        * rendering/RenderMeter.cpp: Added.
+        (WebCore::RenderMeter::RenderMeter):
+        (WebCore::RenderMeter::layout):
+        (WebCore::RenderMeter::updateFromElement):
+        * rendering/RenderMeter.h: Added.
+        (WebCore::RenderMeter::renderName):
+        (WebCore::RenderMeter::isMeter):
+        (WebCore::toRenderMeter):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isMeter):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::adjustStyle):
+        (WebCore::RenderTheme::paint):
+        (WebCore::RenderTheme::paintBorderOnly):
+        (WebCore::RenderTheme::paintDecorations):
+        (WebCore::RenderTheme::adjustMeterStyle):
+        (WebCore::RenderTheme::paintMeter):
+        * rendering/RenderTheme.h:
+
 2010-05-15  Eric Uhrhane  <ericu@chromium.org>
 
         Reviewed by Dmitry Titov.
index 1471ef3..a47007c 100644 (file)
 #include "JSHTMLMediaElement.cpp"
 #include "JSHTMLMenuElement.cpp"
 #include "JSHTMLMetaElement.cpp"
+#include "JSHTMLMeterElement.cpp"
 #include "JSHTMLModElement.cpp"
 #include "JSHTMLObjectElement.cpp"
 #include "JSHTMLOListElement.cpp"
index cf8e020..fe319fc 100644 (file)
@@ -182,6 +182,7 @@ DOM_CLASSES = \
     HTMLMediaElement \
     HTMLMenuElement \
     HTMLMetaElement \
+    HTMLMeterElement \
     HTMLModElement \
     HTMLOListElement \
     HTMLObjectElement \
@@ -644,6 +645,10 @@ ifeq ($(findstring ENABLE_DATALIST,$(FEATURE_DEFINES)), ENABLE_DATALIST)
     HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST=1
 endif
 
+ifeq ($(findstring ENABLE_METER_TAG,$(FEATURE_DEFINES)), ENABLE_METER_TAG)
+    HTML_FLAGS := $(HTML_FLAGS) ENABLE_METER_TAG=1
+endif
+
 ifeq ($(findstring ENABLE_PROGRESS_TAG,$(FEATURE_DEFINES)), ENABLE_PROGRESS_TAG)
     HTML_FLAGS := $(HTML_FLAGS) ENABLE_PROGRESS_TAG=1
 endif
index dbb00f7..973df43 100644 (file)
@@ -244,6 +244,7 @@ IDL_BINDINGS += \
        WebCore/html/MediaError.idl \
        WebCore/html/HTMLMenuElement.idl \
        WebCore/html/HTMLMetaElement.idl \
+       WebCore/html/HTMLMeterElement.idl \
        WebCore/html/HTMLModElement.idl \
        WebCore/html/HTMLOListElement.idl \
        WebCore/html/HTMLObjectElement.idl \
@@ -1167,6 +1168,8 @@ webcore_sources += \
        WebCore/html/HTMLMenuElement.h \
        WebCore/html/HTMLMetaElement.cpp \
        WebCore/html/HTMLMetaElement.h \
+       WebCore/html/HTMLMeterElement.cpp \
+       WebCore/html/HTMLMeterElement.h \
        WebCore/html/HTMLModElement.cpp \
        WebCore/html/HTMLModElement.h \
        WebCore/html/HTMLNameCollection.cpp \
@@ -1900,6 +1903,8 @@ webcore_sources += \
        WebCore/rendering/RenderMarquee.h \
        WebCore/rendering/RenderMenuList.cpp \
        WebCore/rendering/RenderMenuList.h \
+       WebCore/rendering/RenderMeter.cpp \
+       WebCore/rendering/RenderMeter.h \
        WebCore/rendering/RenderObject.cpp \
        WebCore/rendering/RenderObject.h \
        WebCore/rendering/RenderObjectChildList.cpp \
@@ -2247,6 +2252,14 @@ webcore_cppflags += \
        -DENABLE_DATAGRID=0
 
 # ----
+# HTML Meter Element - disable for now.
+# ----
+FEATURE_DEFINES += ENABLE_METER_TAG=0
+
+webcore_cppflags += \
+    -DENABLE_METER_TAG=0
+
+# ----
 # HTML Progress Element - disable for now, since painting code is missing.
 # ----
 FEATURE_DEFINES += ENABLE_PROGRESS_TAG=0
index c058ee3..8f944c5 100644 (file)
             'html/HTMLMediaElement.idl',
             'html/HTMLMenuElement.idl',
             'html/HTMLMetaElement.idl',
+            'html/HTMLMeterElement.idl',
             'html/HTMLModElement.idl',
             'html/HTMLOListElement.idl',
             'html/HTMLObjectElement.idl',
             'html/HTMLMenuElement.h',
             'html/HTMLMetaElement.cpp',
             'html/HTMLMetaElement.h',
+            'html/HTMLMeterElement.cpp',
+            'html/HTMLMeterElement.h',
             'html/HTMLModElement.cpp',
             'html/HTMLModElement.h',
             'html/HTMLNameCollection.cpp',
             'rendering/RenderMediaControlsChromium.h',
             'rendering/RenderMenuList.cpp',
             'rendering/RenderMenuList.h',
+            'rendering/RenderMeter.cpp',
+            'rendering/RenderMeter.h',
             'rendering/RenderObject.cpp',
             'rendering/RenderObject.h',
             'rendering/RenderObjectChildList.cpp',
index d1e9a73..ed956db 100644 (file)
@@ -58,6 +58,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) {
 !contains(DEFINES, ENABLE_VIDEO=.): DEFINES += ENABLE_VIDEO=1
 !contains(DEFINES, ENABLE_RUBY=.): DEFINES += ENABLE_RUBY=1
 !contains(DEFINES, ENABLE_SANDBOX=.): DEFINES += ENABLE_SANDBOX=1
+!contains(DEFINES, ENABLE_METER_TAG=.): DEFINES += ENABLE_METER_TAG=1
 !contains(DEFINES, ENABLE_PROGRESS_TAG=.): DEFINES += ENABLE_PROGRESS_TAG=1
 !contains(DEFINES, ENABLE_BLOB_SLICE=.): DEFINES += ENABLE_BLOB_SLICE=0
 !contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1
@@ -163,6 +164,7 @@ contains(DEFINES, ENABLE_WEB_SOCKETS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_WE
 contains(DEFINES, ENABLE_TOUCH_EVENTS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_TOUCH_EVENTS=1
 contains(DEFINES, ENABLE_TILED_BACKING_STORE=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_TILED_BACKING_STORE=1
 contains(DEFINES, ENABLE_NOTIFICATIONS=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_NOTIFICATIONS=1
+contains(DEFINES, ENABLE_METER_TAG=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_METER_TAG=1
 contains(DEFINES, ENABLE_PROGRESS_TAG=1): FEATURE_DEFINES_JAVASCRIPT += ENABLE_PROGRESS_TAG=1
 
 
@@ -377,6 +379,7 @@ IDL_BINDINGS += \
     html/HTMLMediaElement.idl \
     html/HTMLMenuElement.idl \
     html/HTMLMetaElement.idl \
+    html/HTMLMeterElement.idl \
     html/HTMLModElement.idl \
     html/HTMLObjectElement.idl \
     html/HTMLOListElement.idl \
index a87cc11..d336355 100644 (file)
@@ -655,6 +655,7 @@ SOURCES += \
     html/HTMLMarqueeElement.cpp \
     html/HTMLMenuElement.cpp \
     html/HTMLMetaElement.cpp \
+    html/HTMLMeterElement.cpp \
     html/HTMLModElement.cpp \
     html/HTMLNameCollection.cpp \
     html/HTMLObjectElement.cpp \
@@ -936,6 +937,7 @@ SOURCES += \
     rendering/RenderListMarker.cpp \
     rendering/RenderMarquee.cpp \
     rendering/RenderMenuList.cpp \
+    rendering/RenderMeter.cpp \
     rendering/RenderObject.cpp \
     rendering/RenderObjectChildList.cpp \
     rendering/RenderPart.cpp \
@@ -1376,6 +1378,7 @@ HEADERS += \
     html/HTMLMediaElement.h \
     html/HTMLMenuElement.h \
     html/HTMLMetaElement.h \
+    html/HTMLMeterElement.h \
     html/HTMLModElement.h \
     html/HTMLNameCollection.h \
     html/HTMLNoScriptElement.h \
@@ -1715,6 +1718,7 @@ HEADERS += \
     rendering/RenderMarquee.h \
     rendering/RenderMedia.h \
     rendering/RenderMenuList.h \
+    rendering/RenderMeter.h \
     rendering/RenderObjectChildList.h \
     rendering/RenderObject.h \
     rendering/RenderPart.h \
index 33f61f0..9aca2e8 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLMeterElement.cpp"\r
+                               >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Internal|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_All|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLMeterElement.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLModElement.cpp"\r
                                >\r
                                <FileConfiguration\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\rendering\RenderMeter.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\rendering\RenderMeter.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\rendering\RenderObject.cpp"\r
                                >\r
                        </File>\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\html\HTMLMeterElement.cpp"\r
+                               >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Internal|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release_Cairo|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug_All|Win32"\r
+                                       ExcludedFromBuild="true"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\html\HTMLMeterElement.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\html\HTMLModElement.cpp"\r
                                >\r
                                <FileConfiguration\r
index dd1f019..90de722 100644 (file)
                A43BF5991149290A00C643CA /* HTMLProgressElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A43BF5971149290A00C643CA /* HTMLProgressElement.h */; };
                A43BF59C1149292800C643CA /* RenderProgress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A43BF59A1149292800C643CA /* RenderProgress.cpp */; };
                A43BF59D1149292800C643CA /* RenderProgress.h in Headers */ = {isa = PBXBuildFile; fileRef = A43BF59B1149292800C643CA /* RenderProgress.h */; };
+               A454424A119B3661009BE912 /* HTMLMeterElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A4544248119B3661009BE912 /* HTMLMeterElement.cpp */; };
+               A454424B119B3661009BE912 /* HTMLMeterElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A4544249119B3661009BE912 /* HTMLMeterElement.h */; };
+               A454424E119B3687009BE912 /* RenderMeter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A454424C119B3687009BE912 /* RenderMeter.cpp */; };
+               A454424F119B3687009BE912 /* RenderMeter.h in Headers */ = {isa = PBXBuildFile; fileRef = A454424D119B3687009BE912 /* RenderMeter.h */; };
                A513B3D7114B1666001C429B /* KeyEventCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */; };
                A513B3D8114B166A001C429B /* KeyEventCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */; };
                A59E3C1E11580F510072928E /* KeyEventCodesIPhone.h in Headers */ = {isa = PBXBuildFile; fileRef = A59E3C1C11580F510072928E /* KeyEventCodesIPhone.h */; };
                A43BF5971149290A00C643CA /* HTMLProgressElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLProgressElement.h; sourceTree = "<group>"; };
                A43BF59A1149292800C643CA /* RenderProgress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderProgress.cpp; sourceTree = "<group>"; };
                A43BF59B1149292800C643CA /* RenderProgress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderProgress.h; sourceTree = "<group>"; };
+               A4544248119B3661009BE912 /* HTMLMeterElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMeterElement.cpp; sourceTree = "<group>"; };
+               A4544249119B3661009BE912 /* HTMLMeterElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMeterElement.h; sourceTree = "<group>"; };
+               A454424C119B3687009BE912 /* RenderMeter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMeter.cpp; sourceTree = "<group>"; };
+               A454424D119B3687009BE912 /* RenderMeter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMeter.h; sourceTree = "<group>"; };
                A59E3C1C11580F510072928E /* KeyEventCodesIPhone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCodesIPhone.h; path = iphone/KeyEventCodesIPhone.h; sourceTree = "<group>"; };
                A59E3C1D11580F510072928E /* KeyEventIPhone.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventIPhone.mm; path = iphone/KeyEventIPhone.mm; sourceTree = "<group>"; };
                A5AFB34D115151A700B045CB /* StepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StepRange.cpp; sourceTree = "<group>"; };
                                A871DC1B0A15205700B12A68 /* HTMLMetaElement.cpp */,
                                A871DC180A15205700B12A68 /* HTMLMetaElement.h */,
                                A80E79FC0A19C307007FB8C5 /* HTMLMetaElement.idl */,
+                               A4544248119B3661009BE912 /* HTMLMeterElement.cpp */,
+                               A4544249119B3661009BE912 /* HTMLMeterElement.h */,
                                A8CFF79F0A156978000A4234 /* HTMLModElement.cpp */,
                                A8CFF79D0A156978000A4234 /* HTMLModElement.h */,
                                1AE2AB070A1CE5CF00B42B25 /* HTMLModElement.idl */,
                                E4C279570CF9741900E97B98 /* RenderMedia.h */,
                                ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */,
                                ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */,
+                               A454424C119B3687009BE912 /* RenderMeter.cpp */,
+                               A454424D119B3687009BE912 /* RenderMeter.h */,
                                BCEA4840097D93020094C9E4 /* RenderObject.cpp */,
                                BCEA4841097D93020094C9E4 /* RenderObject.h */,
                                BC60EFB60F33A0E700812A93 /* RenderObjectChildList.cpp */,
                                2E94F43C119207DA00B7F75D /* JSFileReader.h in Headers */,
                                2E94F4511192096A00B7F75D /* FileReader.h in Headers */,
                                E440A2D71191A523000820B0 /* SVGFELighting.h in Headers */,
+                               A454424B119B3661009BE912 /* HTMLMeterElement.h in Headers */,
+                               A454424F119B3687009BE912 /* RenderMeter.h in Headers */,
                                B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */,
                                4FD8D0F3119C718B002FA825 /* ScriptGCEvent.h in Headers */,
                        );
                                2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */,
                                2E94F4501192096400B7F75D /* FileReader.cpp in Sources */,
                                E440A2D51191A50B000820B0 /* SVGFELighting.cpp in Sources */,
+                               A454424A119B3661009BE912 /* HTMLMeterElement.cpp in Sources */,
+                               A454424E119B3687009BE912 /* RenderMeter.cpp in Sources */,
                                B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */,
                                4FD8D0F2119C718B002FA825 /* ScriptGCEvent.cpp in Sources */,
                        );
index d621621..0f302a0 100644 (file)
@@ -275,6 +275,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
         case MenulistTextFieldPart:
             m_value.ident = CSSValueMenulistTextfield;
             break;
+        case MeterPart:
+            m_value.ident = CSSValueMeter;
+            break;
         case OuterSpinButtonPart:
             m_value.ident = CSSValueOuterSpinButton;
             break;
index 06d966c..a20e64f 100644 (file)
@@ -589,6 +589,7 @@ menulist
 menulist-button
 menulist-text
 menulist-textfield
+meter
 outer-spin-button
 progress-bar
 progress-bar-value
index 01103f4..b4bb05a 100644 (file)
@@ -517,6 +517,20 @@ option {
     font-weight: normal;
 }
 
+/* meter */
+
+meter {
+    -webkit-appearance: meter;
+    display: inline-block;
+    height: 1em;
+    width: 5em;
+    vertical-align: -0.2em;
+}
+
+meter::-webkit-meter {
+    -webkit-appearance: meter;
+}
+
 /* progress */
 
 progress {
index 7a353b2..7cde32f 100644 (file)
@@ -98,6 +98,7 @@ frameborder
 headers
 height
 hidden
+high
 href
 hreflang
 hspace
@@ -115,6 +116,7 @@ link
 list
 longdesc
 loop
+low
 playcount
 loopend
 loopstart
@@ -219,6 +221,7 @@ onwebkitanimationend
 onwebkitbeginfullscreen
 onwebkitendfullscreen
 onwebkittransitionend
+optimum
 pattern
 placeholder
 pluginurl
index f2ffc16..77aa93b 100644 (file)
@@ -861,6 +861,7 @@ static HashSet<AtomicStringImpl*>* inlineTagList()
 #if ENABLE(PROGRESS_TAG)
         tagList.add(progressTag.localName().impl());
 #endif
+        tagList.add(meterTag.localName().impl());
     }
     return &tagList;
 }
index 4cee927..f19addf 100644 (file)
@@ -77,6 +77,7 @@
 #include "HTMLMediaElement.cpp"
 #include "HTMLMenuElement.cpp"
 #include "HTMLMetaElement.cpp"
+#include "HTMLMeterElement.cpp"
 #include "HTMLModElement.cpp"
 #include "HTMLOListElement.cpp"
 #include "HTMLObjectElement.cpp"
diff --git a/WebCore/html/HTMLMeterElement.cpp b/WebCore/html/HTMLMeterElement.cpp
new file mode 100644 (file)
index 0000000..2c1f8a5
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#if ENABLE(METER_TAG)
+#include "HTMLMeterElement.h"
+
+#include "EventNames.h"
+#include "FormDataList.h"
+#include "HTMLFormElement.h"
+#include "HTMLNames.h"
+#include "HTMLParser.h"
+#include "MappedAttribute.h"
+#include "RenderMeter.h"
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLMeterElement::HTMLMeterElement(const QualifiedName& tagName, Document* document)
+    : HTMLFormControlElement(tagName, document, 0, CreateHTMLElement)
+{
+    ASSERT(hasTagName(meterTag));
+}
+
+PassRefPtr<HTMLMeterElement> HTMLMeterElement::create(const QualifiedName& tagName, Document* document)
+{
+    return adoptRef(new HTMLMeterElement(tagName, document));
+}
+
+RenderObject* HTMLMeterElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderMeter(this);
+}
+
+const AtomicString& HTMLMeterElement::formControlType() const
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, meter, ("meter"));
+    return meter;
+}
+
+void HTMLMeterElement::parseMappedAttribute(MappedAttribute* attribute)
+{
+    if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr) {
+        if (renderer())
+            renderer()->updateFromElement();
+    } else
+        HTMLFormControlElement::parseMappedAttribute(attribute);
+}
+
+double HTMLMeterElement::min() const
+{
+    double min = 0;
+    parseToDoubleForNumberType(getAttribute(minAttr), &min);
+    return min;
+}
+
+void HTMLMeterElement::setMin(double min, ExceptionCode& ec)
+{
+    if (!isfinite(min)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    setAttribute(minAttr, String::number(min));
+}
+
+double HTMLMeterElement::max() const
+{
+    double max = std::max(1.0, min());
+    parseToDoubleForNumberType(getAttribute(maxAttr), &max);
+    return std::max(max, min());
+}
+
+void HTMLMeterElement::setMax(double max, ExceptionCode& ec)
+{
+    if (!isfinite(max)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    setAttribute(maxAttr, String::number(max));
+}
+
+double HTMLMeterElement::value() const
+{
+    double value = 0;
+    parseToDoubleForNumberType(getAttribute(valueAttr), &value);
+    return std::min(std::max(value, min()), max());
+}
+
+void HTMLMeterElement::setValue(double value, ExceptionCode& ec)
+{
+    if (!isfinite(value)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    setAttribute(valueAttr, String::number(value));
+}
+
+double HTMLMeterElement::low() const
+{
+    double low = min();
+    parseToDoubleForNumberType(getAttribute(lowAttr), &low);
+    return std::min(std::max(low, min()), max());
+}
+
+void HTMLMeterElement::setLow(double low, ExceptionCode& ec)
+{
+    if (!isfinite(low)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    setAttribute(lowAttr, String::number(low));
+}
+
+double HTMLMeterElement::high() const
+{
+    double high = max();
+    parseToDoubleForNumberType(getAttribute(highAttr), &high);
+    return std::min(std::max(high, low()), max());
+}
+
+void HTMLMeterElement::setHigh(double high, ExceptionCode& ec)
+{
+    if (!isfinite(high)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    setAttribute(highAttr, String::number(high));
+}
+
+double HTMLMeterElement::optimum() const
+{
+    double optimum = (max() + min()) / 2;
+    parseToDoubleForNumberType(getAttribute(optimumAttr), &optimum);
+    return std::min(std::max(optimum, min()), max());
+}
+
+void HTMLMeterElement::setOptimum(double optimum, ExceptionCode& ec)
+{
+    if (!isfinite(optimum)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+    setAttribute(optimumAttr, String::number(optimum));
+}
+
+} // namespace
+#endif
diff --git a/WebCore/html/HTMLMeterElement.h b/WebCore/html/HTMLMeterElement.h
new file mode 100644 (file)
index 0000000..0808b9f
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HTMLMeterElement_h
+#define HTMLMeterElement_h
+
+#if ENABLE(METER_TAG)
+#include "HTMLFormControlElement.h"
+
+namespace WebCore {
+
+class HTMLMeterElement : public HTMLFormControlElement {
+public:
+    static PassRefPtr<HTMLMeterElement> create(const QualifiedName&, Document*);
+
+    double min() const;
+    void setMin(double, ExceptionCode&);
+
+    double max() const;
+    void setMax(double, ExceptionCode&);
+
+    double value() const;
+    void setValue(double, ExceptionCode&);
+
+    double low() const;
+    void setLow(double, ExceptionCode&);
+
+    double high() const;
+    void setHigh(double, ExceptionCode&);
+
+    double optimum() const;
+    void setOptimum(double, ExceptionCode&);
+
+private:
+    HTMLMeterElement(const QualifiedName&, Document*);
+
+    virtual bool recalcWillValidate() const { return false; }
+
+    virtual const AtomicString& formControlType() const;
+
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+
+    virtual void parseMappedAttribute(MappedAttribute*);
+};
+
+} // namespace
+
+#endif
+#endif
diff --git a/WebCore/html/HTMLMeterElement.idl b/WebCore/html/HTMLMeterElement.idl
new file mode 100644 (file)
index 0000000..e061764
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+module html {
+    interface [
+        Conditional=METER_TAG
+    ] HTMLMeterElement : HTMLElement {
+                 attribute double value
+                     setter raises(DOMException);
+                 attribute double min
+                     setter raises(DOMException);
+                 attribute double max
+                     setter raises(DOMException);
+                 attribute double low
+                     setter raises(DOMException);
+                 attribute double high
+                     setter raises(DOMException);
+                 attribute double optimum
+                     setter raises(DOMException);
+        readonly attribute HTMLFormElement form;
+    };
+}
index 9f4900c..6374b4d 100644 (file)
@@ -77,6 +77,7 @@ map createWithNew
 marquee createWithNew
 menu createWithNew
 meta createWithNew
+meter interfaceName=HTMLMeterElement, conditional=METER_TAG
 nav interfaceName=HTMLElement
 nobr interfaceName=HTMLElement
 noembed interfaceName=HTMLElement
index 85e609a..ca9417b 100644 (file)
@@ -412,6 +412,9 @@ module window {
         attribute HTMLMarqueeElementConstructor HTMLMarqueeElement;
         attribute HTMLMenuElementConstructor HTMLMenuElement;
         attribute HTMLMetaElementConstructor HTMLMetaElement;
+#if defined(ENABLE_METER_TAG) && ENABLE_METER_TAG
+        attribute HTMLMeterElementConstructor HTMLMeterElement;
+#endif
         attribute HTMLModElementConstructor HTMLModElement;
         attribute HTMLOListElementConstructor HTMLOListElement;
         attribute HTMLObjectElementConstructor HTMLObjectElement;
index de71899..657797f 100644 (file)
@@ -52,7 +52,7 @@ enum ControlPart {
     MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart,
     MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart,
     MediaControlsBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart,
-    MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart, ProgressBarPart, ProgressBarValuePart,
+    MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, MeterPart, OuterSpinButtonPart, ProgressBarPart, ProgressBarValuePart,
     SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
     SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
     SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
diff --git a/WebCore/rendering/RenderMeter.cpp b/WebCore/rendering/RenderMeter.cpp
new file mode 100644 (file)
index 0000000..9dc6a26
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#if ENABLE(METER_TAG)
+
+#include "RenderMeter.h"
+
+#include "HTMLMeterElement.h"
+#include "RenderTheme.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+RenderMeter::RenderMeter(HTMLMeterElement* element)
+    : RenderBlock(element)
+{
+}
+
+void RenderMeter::layout()
+{
+    ASSERT(needsLayout());
+
+    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
+
+    calcWidth();
+    calcHeight();
+
+    m_overflow.clear();
+
+    repainter.repaintAfterLayout();
+
+    setNeedsLayout(false);
+}
+
+void RenderMeter::updateFromElement()
+{
+    repaint();
+}
+
+} // namespace WebCore
+#endif
diff --git a/WebCore/rendering/RenderMeter.h b/WebCore/rendering/RenderMeter.h
new file mode 100644 (file)
index 0000000..2fc7844
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef RenderMeter_h
+#define RenderMeter_h
+
+#if ENABLE(METER_TAG)
+#include "RenderBlock.h"
+#include "RenderWidget.h"
+
+namespace WebCore {
+
+class HTMLMeterElement;
+
+class RenderMeter : public RenderBlock {
+public:
+    RenderMeter(HTMLMeterElement*);
+
+private:
+    virtual const char* renderName() const { return "RenderMeter"; }
+    virtual bool isMeter() const { return true; }
+    virtual void layout();
+    virtual void updateFromElement();
+};
+
+inline RenderMeter* toRenderMeter(RenderObject* object)
+{
+    ASSERT(!object || object->isMeter());
+    return static_cast<RenderMeter*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toRenderMeter(const RenderMeter*);
+
+} // namespace WebCore
+
+#endif
+
+#endif // RenderMeter_h
+
index 9d8a306..3fce1ee 100644 (file)
@@ -276,6 +276,9 @@ public:
     virtual bool isListMarker() const { return false; }
     virtual bool isMedia() const { return false; }
     virtual bool isMenuList() const { return false; }
+#if ENABLE(METER_TAG)
+    virtual bool isMeter() const { return false; }
+#endif
 #if ENABLE(PROGRESS_TAG)
     virtual bool isProgress() const { return false; }
 #endif
index f161ff6..96d37c3 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "CSSValueKeywords.h"
 #include "Document.h"
+#include "FloatConversion.h"
 #include "FocusController.h"
 #include "FontSelector.h"
 #include "Frame.h"
 #include "Settings.h"
 #include "TextControlInnerElements.h"
 
+#if ENABLE(METER_TAG)
+#include "HTMLMeterElement.h"
+#include "RenderMeter.h"
+#endif
+
 // The methods in this file are shared by all themes on every platform.
 
 namespace WebCore {
@@ -214,6 +220,10 @@ void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, El
         case ProgressBarPart:
             return adjustProgressBarStyle(selector, style, e);
 #endif
+#if ENABLE(Meter_TAG)
+        case MeterPart:
+            return adjustMeterStyle(selector, style, e);
+#endif
         default:
             break;
     }
@@ -272,6 +282,10 @@ bool RenderTheme::paint(RenderObject* o, const RenderObject::PaintInfo& paintInf
 #endif
         case MenulistPart:
             return paintMenuList(o, paintInfo, r);
+#if ENABLE(METER_TAG)
+        case MeterPart:
+            return paintMeter(o, paintInfo, r);
+#endif
 #if ENABLE(PROGRESS_TAG)
         case ProgressBarPart:
             return paintProgressBar(o, paintInfo, r);
@@ -366,6 +380,9 @@ bool RenderTheme::paintBorderOnly(RenderObject* o, const RenderObject::PaintInfo
         case DefaultButtonPart:
         case ButtonPart:
         case MenulistPart:
+#if ENABLE(METER_TAG)
+        case MeterPart:
+#endif
 #if ENABLE(PROGRESS_TAG)
         case ProgressBarPart:
 #endif
@@ -404,6 +421,9 @@ bool RenderTheme::paintDecorations(RenderObject* o, const RenderObject::PaintInf
         case DefaultButtonPart:
         case ButtonPart:
         case MenulistPart:
+#if ENABLE(METER_TAG)
+        case MeterPart:
+#endif
 #if ENABLE(PROGRESS_TAG)
         case ProgressBarPart:
 #endif
@@ -867,6 +887,61 @@ void RenderTheme::adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*)
 {
 }
 
+#if ENABLE(METER_TAG)
+void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+    style->setBoxShadow(0);
+}
+
+bool RenderTheme::paintMeter(RenderObject* renderObject, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+{
+    // Some platforms do not have a native gauge widget, so we draw here a default implementation.
+    RenderMeter* renderMeter = toRenderMeter(renderObject);
+    RenderStyle* style = renderObject->style();
+    int left = style->borderLeft().width() + style->paddingLeft().value();
+    int top = style->borderTop().width() + style->paddingTop().value();
+    int right = style->borderRight().width() + style->paddingRight().value();
+    int bottom = style->borderBottom().width() + style->paddingBottom().value();
+    FloatRect innerRect(rect.x() + left, rect.y() + top, rect.width() - left - right, rect.height() - top - bottom);
+
+    HTMLMeterElement* element = static_cast<HTMLMeterElement*>(renderMeter->node());
+    double min = element->min();
+    double max = element->max();
+    double value = element->value();
+
+    if (min >= max) {
+        paintInfo.context->fillRect(innerRect, Color::black, style->colorSpace());
+        return false;
+    }
+
+    // Paint the background first
+    paintInfo.context->fillRect(innerRect, Color::lightGray, style->colorSpace());
+
+    FloatRect valueRect;
+
+    if (rect.width() < rect.height()) {
+        // Vertical gauge
+        double scale = innerRect.height() / (max - min);
+        valueRect.setLocation(FloatPoint(innerRect.x(), innerRect.y() + narrowPrecisionToFloat((max - value) * scale)));
+        valueRect.setSize(FloatSize(innerRect.width(), narrowPrecisionToFloat((value - min) * scale)));
+    } else if (renderMeter->style()->direction() == RTL) {
+        // right to left horizontal gauge
+        double scale = innerRect.width() / (max - min);
+        valueRect.setLocation(FloatPoint(innerRect.x() + narrowPrecisionToFloat((max - value) * scale), innerRect.y()));
+        valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min) * scale), innerRect.height()));
+    } else {
+        // left to right horizontal gauge
+        double scale = innerRect.width() / (max - min);
+        valueRect.setLocation(innerRect.location());
+        valueRect.setSize(FloatSize(narrowPrecisionToFloat((value - min)) * scale, innerRect.height()));
+    }
+    if (!valueRect.isEmpty())
+        paintInfo.context->fillRect(valueRect, Color::black, style->colorSpace());
+
+    return false;
+}
+#endif
+
 #if ENABLE(PROGRESS_TAG)
 double RenderTheme::animationRepeatIntervalForProgressBar(RenderProgress*) const
 {
index c642a28..112321e 100644 (file)
@@ -237,6 +237,11 @@ protected:
     virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
 
+#if ENABLE(METER_TAG)
+    virtual void adjustMeterStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+    virtual bool paintMeter(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+#endif
+
 #if ENABLE(PROGRESS_TAG)
     virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }