WebCore/ChangeLog

 12010-03-09 Yael Aharon <yael.aharon@nokia.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Support for HTMLProgressElement
 6 https://bugs.webkit.org/show_bug.cgi?id=35937
 7
 8 Added support for HTMLProgressElement.
 9 This implementation is enabled only for Qt, because only RenderThemeQt
 10 was modified to actually draw the progress element.
 11 The labels attribute of the progress element will be implemented in a
 12 separate patch.
 13
 14 Tests: fast/dom/HTMLProgressElement/progress-element.html
 15 fast/dom/HTMLProgressElement/set-progress-properties.html
 16
 17 * DerivedSources.cpp:
 18 * DerivedSources.make:
 19 * GNUmakefile.am:
 20 * WebCore.gypi:
 21 * WebCore.pri:
 22 * WebCore.pro:
 23 * WebCore.vcproj/WebCore.vcproj:
 24 * css/CSSPrimitiveValueMappings.h:
 25 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
 26 * css/CSSSelector.cpp:
 27 (WebCore::CSSSelector::extractPseudoType):
 28 * css/CSSValueKeywords.in:
 29 * css/html.css:
 30 * html/HTMLElement.cpp:
 31 (WebCore::inlineTagList):
 32 * html/HTMLElementsAllInOne.cpp:
 33 * html/HTMLFormControlElement.cpp:
 34 (WebCore::HTMLFormControlElement::HTMLFormControlElement):
 35 * html/HTMLFormControlElement.h:
 36 * html/HTMLProgressElement.cpp: Added.
 37 (WebCore::HTMLProgressElement::HTMLProgressElement):
 38 (WebCore::HTMLProgressElement::create):
 39 (WebCore::HTMLProgressElement::createRenderer):
 40 (WebCore::HTMLProgressElement::formControlType):
 41 (WebCore::HTMLProgressElement::parseMappedAttribute):
 42 (WebCore::HTMLProgressElement::value):
 43 (WebCore::HTMLProgressElement::setValue):
 44 (WebCore::HTMLProgressElement::max):
 45 (WebCore::HTMLProgressElement::setMax):
 46 (WebCore::HTMLProgressElement::position):
 47 * html/HTMLProgressElement.h: Added.
 48 (WebCore::HTMLProgressElement::isOptionalFormControl):
 49 * html/HTMLProgressElement.idl: Added.
 50 * html/HTMLTagNames.in:
 51 * page/DOMWindow.idl:
 52 * platform/ThemeTypes.h:
 53 * platform/qt/RenderThemeQt.cpp:
 54 (WebCore::RenderThemeQt::adjustProgressBarStyle):
 55 (WebCore::RenderThemeQt::paintProgressBar):
 56 * platform/qt/RenderThemeQt.h:
 57 * rendering/RenderObject.h:
 58 (WebCore::RenderObject::isProgress):
 59 * rendering/RenderProgress.cpp: Added.
 60 (WebCore::RenderProgress::RenderProgress):
 61 (WebCore::RenderProgress::baselinePosition):
 62 (WebCore::RenderProgress::calcPrefWidths):
 63 (WebCore::RenderProgress::layout):
 64 (WebCore::RenderProgress::updateFromElement):
 65 * rendering/RenderProgress.h: Added.
 66 (WebCore::RenderProgress::renderName):
 67 (WebCore::RenderProgress::isProgress):
 68 (WebCore::toRenderProgress):
 69 * rendering/RenderTheme.cpp:
 70 (WebCore::RenderTheme::adjustStyle):
 71 (WebCore::RenderTheme::paint):
 72 (WebCore::RenderTheme::paintBorderOnly):
 73 (WebCore::RenderTheme::paintDecorations):
 74 (WebCore::RenderTheme::adjustProgressBarStyle):
 75 * rendering/RenderTheme.h:
 76 (WebCore::RenderTheme::paintProgressBar):
 77
1782010-03-10 Gavin Barraclough <barraclough@apple.com>
279
380 Reviewed by Darin Adler, Geoffrey Garen, Maciej Stachowiak.
55826

WebCore/DerivedSources.cpp

143143#include "JSHTMLParagraphElement.cpp"
144144#include "JSHTMLParamElement.cpp"
145145#include "JSHTMLPreElement.cpp"
 146#include "JSHTMLProgressElement.cpp"
146147#include "JSHTMLQuoteElement.cpp"
147148#include "JSHTMLScriptElement.cpp"
148149#include "JSHTMLSelectElement.cpp"
55826

WebCore/DerivedSources.make

@@DOM_CLASSES = \
185185 HTMLParagraphElement \
186186 HTMLParamElement \
187187 HTMLPreElement \
 188 HTMLProgressElement \
188189 HTMLQuoteElement \
189190 HTMLScriptElement \
190191 HTMLSelectElement \

@@ifeq ($(findstring ENABLE_DATALIST,$(FEA
620621 HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST=1
621622endif
622623
 624ifeq ($(findstring ENABLE_PROGRESS_TAG,$(FEATURE_DEFINES)), ENABLE_PROGRESS_TAG)
 625 HTML_FLAGS := $(HTML_FLAGS) ENABLE_PROGRESS_TAG=1
 626endif
 627
623628ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
624629 HTML_FLAGS := $(HTML_FLAGS) ENABLE_VIDEO=1
625630endif
55826

WebCore/GNUmakefile.am

@@IDL_BINDINGS += \
240240 WebCore/html/HTMLParagraphElement.idl \
241241 WebCore/html/HTMLParamElement.idl \
242242 WebCore/html/HTMLPreElement.idl \
 243 WebCore/html/HTMLProgressElement.idl \
243244 WebCore/html/HTMLQuoteElement.idl \
244245 WebCore/html/HTMLScriptElement.idl \
245246 WebCore/html/HTMLSelectElement.idl \

@@webcore_sources += \
11451146 WebCore/html/HTMLPlugInImageElement.h \
11461147 WebCore/html/HTMLPreElement.cpp \
11471148 WebCore/html/HTMLPreElement.h \
 1149 WebCore/html/HTMLProgressElement.cpp \
 1150 WebCore/html/HTMLProgressElement.h \
11481151 WebCore/html/HTMLQuoteElement.cpp \
11491152 WebCore/html/HTMLQuoteElement.h \
11501153 WebCore/html/HTMLScriptElement.cpp \

@@webcore_sources += \
18471850 WebCore/rendering/RenderPart.h \
18481851 WebCore/rendering/RenderPartObject.cpp \
18491852 WebCore/rendering/RenderPartObject.h \
 1853 WebCore/rendering/RenderProgress.cpp \
 1854 WebCore/rendering/RenderProgress.h \
18501855 WebCore/rendering/RenderReplaced.cpp \
18511856 WebCore/rendering/RenderReplaced.h \
18521857 WebCore/rendering/RenderReplica.cpp \

@@webcore_cppflags += \
21712176 -DENABLE_DATAGRID=0
21722177
21732178# ----
 2179# HTML Progress Element - disable for now, since painting code is missing.
 2180# ----
 2181FEATURE_DEFINES += ENABLE_PROGRESS_TAG=0
 2182
 2183webcore_cppflags += \
 2184 -DENABLE_PROGRESS_TAG=0
 2185
 2186# ----
21742187# JavaScript Debugger/Profiler
21752188# ----
21762189if ENABLE_JAVASCRIPT_DEBUGGER
55826

WebCore/WebCore.gypi

163163 'html/HTMLParagraphElement.idl',
164164 'html/HTMLParamElement.idl',
165165 'html/HTMLPreElement.idl',
 166 'html/HTMLProgressElement.idl',
166167 'html/HTMLQuoteElement.idl',
167168 'html/HTMLScriptElement.idl',
168169 'html/HTMLSelectElement.idl',

15581559 'html/HTMLPlugInImageElement.h',
15591560 'html/HTMLPreElement.cpp',
15601561 'html/HTMLPreElement.h',
 1562 'html/HTMLProgressElement.cpp',
 1563 'html/HTMLProgressElement.h',
15611564 'html/HTMLQuoteElement.cpp',
15621565 'html/HTMLQuoteElement.h',
15631566 'html/HTMLScriptElement.cpp',

31013104 'rendering/RenderPartObject.h',
31023105 'rendering/RenderPath.cpp',
31033106 'rendering/RenderPath.h',
 3107 'rendering/RenderProgress.cpp',
 3108 'rendering/RenderProgress.h',
31043109 'rendering/RenderReplaced.cpp',
31053110 'rendering/RenderReplaced.h',
31063111 'rendering/RenderReplica.cpp',
55826

WebCore/WebCore.pri

@@contains(DEFINES, ENABLE_SINGLE_THREADED
5454!contains(DEFINES, ENABLE_VIDEO=.): DEFINES += ENABLE_VIDEO=1
5555!contains(DEFINES, ENABLE_RUBY=.): DEFINES += ENABLE_RUBY=1
5656!contains(DEFINES, ENABLE_SANDBOX=.): DEFINES += ENABLE_SANDBOX=1
 57!contains(DEFINES, ENABLE_PROGRESS_TAG=.): DEFINES += ENABLE_PROGRESS_TAG=1
5758!contains(DEFINES, ENABLE_BLOB_SLICE=.): DEFINES += ENABLE_BLOB_SLICE=0
5859
5960greaterThan(QT_MINOR_VERSION, 5) {

@@IDL_BINDINGS += \
361362 html/HTMLParagraphElement.idl \
362363 html/HTMLParamElement.idl \
363364 html/HTMLPreElement.idl \
 365 html/HTMLProgressElement.idl \
364366 html/HTMLQuoteElement.idl \
365367 html/HTMLScriptElement.idl \
366368 html/HTMLSelectElement.idl \
55826

WebCore/WebCore.pro

@@SOURCES += \
666666 html/HTMLPlugInElement.cpp \
667667 html/HTMLPlugInImageElement.cpp \
668668 html/HTMLPreElement.cpp \
 669 html/HTMLProgressElement.cpp \
669670 html/HTMLQuoteElement.cpp \
670671 html/HTMLScriptElement.cpp \
671672 html/HTMLSelectElement.cpp \

@@SOURCES += \
929930 rendering/RenderObjectChildList.cpp \
930931 rendering/RenderPart.cpp \
931932 rendering/RenderPartObject.cpp \
 933 rendering/RenderProgress.cpp \
932934 rendering/RenderReplaced.cpp \
933935 rendering/RenderReplica.cpp \
934936 rendering/RenderRuby.cpp \

@@HEADERS += \
13671369 html/HTMLPlugInElement.h \
13681370 html/HTMLPlugInImageElement.h \
13691371 html/HTMLPreElement.h \
 1372 html/HTMLProgressElement.h \
13701373 html/HTMLQuoteElement.h \
13711374 html/HTMLScriptElement.h \
13721375 html/HTMLSelectElement.h \

@@HEADERS += \
16701673 rendering/RenderPart.h \
16711674 rendering/RenderPartObject.h \
16721675 rendering/RenderPath.h \
 1676 rendering/RenderProgress.h \
16731677 rendering/RenderReplaced.h \
16741678 rendering/RenderReplica.h \
16751679 rendering/RenderRuby.h \
55826

WebCore/WebCore.vcproj/WebCore.vcproj

68856885 >
68866886 </File>
68876887 <File
 6888 RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLProgressElement.cpp"
 6889 >
 6890 <FileConfiguration
 6891 Name="Debug|Win32"
 6892 ExcludedFromBuild="true"
 6893 >
 6894 <Tool
 6895 Name="VCCLCompilerTool"
 6896 />
 6897 </FileConfiguration>
 6898 <FileConfiguration
 6899 Name="Release|Win32"
 6900 ExcludedFromBuild="true"
 6901 >
 6902 <Tool
 6903 Name="VCCLCompilerTool"
 6904 />
 6905 </FileConfiguration>
 6906 <FileConfiguration
 6907 Name="Debug_Internal|Win32"
 6908 ExcludedFromBuild="true"
 6909 >
 6910 <Tool
 6911 Name="VCCLCompilerTool"
 6912 />
 6913 </FileConfiguration>
 6914 <FileConfiguration
 6915 Name="Debug_Cairo|Win32"
 6916 ExcludedFromBuild="true"
 6917 >
 6918 <Tool
 6919 Name="VCCLCompilerTool"
 6920 />
 6921 </FileConfiguration>
 6922 <FileConfiguration
 6923 Name="Release_Cairo|Win32"
 6924 ExcludedFromBuild="true"
 6925 >
 6926 <Tool
 6927 Name="VCCLCompilerTool"
 6928 />
 6929 </FileConfiguration>
 6930 <FileConfiguration
 6931 Name="Debug_All|Win32"
 6932 ExcludedFromBuild="true"
 6933 >
 6934 <Tool
 6935 Name="VCCLCompilerTool"
 6936 />
 6937 </FileConfiguration>
 6938 </File>
 6939 <File
 6940 RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLProgressElement.h"
 6941 >
 6942 </File>
 6943 <File
68886944 RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLQuoteElement.cpp"
68896945 >
68906946 <FileConfiguration

2749727553 >
2749827554 </File>
2749927555 <File
 27556 RelativePath="..\rendering\RenderProgress.cpp"
 27557 >
 27558 </File>
 27559 <File
 27560 RelativePath="..\rendering\RenderProgress.h"
 27561 >
 27562 </File>
 27563 <File
2750027564 RelativePath="..\rendering\RenderReplaced.cpp"
2750127565 >
2750227566 </File>

3324133305 >
3324233306 </File>
3324333307 <File
 33308 RelativePath="..\html\HTMLProgressElement.cpp"
 33309 >
 33310 <FileConfiguration
 33311 Name="Debug|Win32"
 33312 ExcludedFromBuild="true"
 33313 >
 33314 <Tool
 33315 Name="VCCLCompilerTool"
 33316 />
 33317 </FileConfiguration>
 33318 <FileConfiguration
 33319 Name="Release|Win32"
 33320 ExcludedFromBuild="true"
 33321 >
 33322 <Tool
 33323 Name="VCCLCompilerTool"
 33324 />
 33325 </FileConfiguration>
 33326 <FileConfiguration
 33327 Name="Debug_Internal|Win32"
 33328 ExcludedFromBuild="true"
 33329 >
 33330 <Tool
 33331 Name="VCCLCompilerTool"
 33332 />
 33333 </FileConfiguration>
 33334 <FileConfiguration
 33335 Name="Debug_Cairo|Win32"
 33336 ExcludedFromBuild="true"
 33337 >
 33338 <Tool
 33339 Name="VCCLCompilerTool"
 33340 />
 33341 </FileConfiguration>
 33342 <FileConfiguration
 33343 Name="Release_Cairo|Win32"
 33344 ExcludedFromBuild="true"
 33345 >
 33346 <Tool
 33347 Name="VCCLCompilerTool"
 33348 />
 33349 </FileConfiguration>
 33350 <FileConfiguration
 33351 Name="Debug_All|Win32"
 33352 ExcludedFromBuild="true"
 33353 >
 33354 <Tool
 33355 Name="VCCLCompilerTool"
 33356 />
 33357 </FileConfiguration>
 33358 </File>
 33359 <File
 33360 RelativePath="..\html\HTMLProgressElement.h"
 33361 >
 33362 </File>
 33363 <File
3324433364 RelativePath="..\html\HTMLQuoteElement.cpp"
3324533365 >
3324633366 <FileConfiguration
55826

WebCore/css/CSSPrimitiveValueMappings.h

@@template<> inline CSSPrimitiveValue::CSS
275275 case OuterSpinButtonPart:
276276 m_value.ident = CSSValueOuterSpinButton;
277277 break;
 278#if ENABLE(PROGRESS_BAR)
 279 case ProgressBarPart:
 280 m_value.ident = CSSValueProgressBar;
 281 break;
 282#endif
278283 case SliderHorizontalPart:
279284 m_value.ident = CSSValueSliderHorizontal;
280285 break;
55826

WebCore/css/CSSSelector.cpp

@@void CSSSelector::extractPseudoType() co
129129 DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type"));
130130 DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional"));
131131 DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button"));
 132#if ENABLE(PROGRESS_BAR)
 133 DEFINE_STATIC_LOCAL(AtomicString, progressBar, ("-webkit-progress-bar"));
 134#endif
132135 DEFINE_STATIC_LOCAL(AtomicString, required, ("required"));
133136 DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer"));
134137 DEFINE_STATIC_LOCAL(AtomicString, root, ("root"));
55826

WebCore/css/CSSValueKeywords.in

@@menulist-button
582582menulist-text
583583menulist-textfield
584584outer-spin-button
 585progress-bar
585586slider-horizontal
586587slider-vertical
587588sliderthumb-horizontal
55826

WebCore/css/html.css

@@option {
515515 font-weight: normal;
516516}
517517
 518/* progress */
 519
 520progress {
 521 -webkit-appearance: progress-bar;
 522 padding: initial;
 523 border: initial;
 524 margin: 2px;
 525}
 526
 527progress::-webkit-progress-bar {
 528 -webkit-appearance: progress-bar;
 529}
 530
518531/* datagrid */
519532
520533datagrid {
55826

WebCore/html/HTMLElement.cpp

@@static HashSet<AtomicStringImpl*>* inlin
854854 tagList.add(rpTag.localName().impl());
855855 tagList.add(rtTag.localName().impl());
856856 tagList.add(rubyTag.localName().impl());
 857#if ENABLE(PROGRESS_TAG)
 858 tagList.add(progressTag.localName().impl());
 859#endif
857860 }
858861 return &tagList;
859862}
55826

WebCore/html/HTMLElementsAllInOne.cpp

8787#include "HTMLPlugInElement.cpp"
8888#include "HTMLPlugInImageElement.cpp"
8989#include "HTMLPreElement.cpp"
 90#include "HTMLProgressElement.cpp"
9091#include "HTMLQuoteElement.cpp"
9192#include "HTMLScriptElement.cpp"
9293#include "HTMLSelectElement.cpp"
55826

WebCore/html/HTMLFormControlElement.cpp

@@namespace WebCore {
4949
5050using namespace HTMLNames;
5151
52 HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f)
53  : HTMLElement(tagName, doc)
 52HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f, ConstructionType constructionType)
 53 : HTMLElement(tagName, doc, constructionType)
5454 , m_form(f)
5555 , m_hasName(false)
5656 , m_disabled(false)
55826

WebCore/html/HTMLFormControlElement.h

@@class VisibleSelection;
3636
3737class HTMLFormControlElement : public HTMLElement {
3838public:
39  HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*);
 39 HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*, ConstructionType = CreateElementZeroRefCount);
4040 virtual ~HTMLFormControlElement();
4141
4242 virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
55826

WebCore/html/HTMLProgressElement.cpp

 1/*
 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Library General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Library General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Library General Public License
 15 * along with this library; see the file COPYING.LIB. If not, write to
 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17 * Boston, MA 02110-1301, USA.
 18 *
 19 */
 20
 21#include "config.h"
 22#if ENABLE(PROGRESS_TAG)
 23#include "HTMLProgressElement.h"
 24
 25#include "EventNames.h"
 26#include "FormDataList.h"
 27#include "HTMLFormElement.h"
 28#include "HTMLNames.h"
 29#include "MappedAttribute.h"
 30#include "RenderProgress.h"
 31#include <wtf/StdLibExtras.h>
 32
 33namespace WebCore {
 34
 35using namespace HTMLNames;
 36
 37HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
 38 : HTMLFormControlElement(tagName, document, form, CreateElement)
 39 , m_value(1)
 40 , m_max(1)
 41 , m_isDeterminate(false)
 42{
 43 ASSERT(hasTagName(progressTag));
 44}
 45
 46PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
 47{
 48 return adoptRef(new HTMLProgressElement(tagName, document, form));
 49}
 50
 51RenderObject* HTMLProgressElement::createRenderer(RenderArena* arena, RenderStyle* style)
 52{
 53 return new (arena) RenderProgress(this);
 54}
 55
 56const AtomicString& HTMLProgressElement::formControlType() const
 57{
 58 DEFINE_STATIC_LOCAL(const AtomicString, progress, ("progress"));
 59 return progress;
 60}
 61
 62void HTMLProgressElement::parseMappedAttribute(MappedAttribute* attr)
 63{
 64 if (attr->name() == valueAttr) {
 65 m_isDeterminate = true;
 66 bool ok;
 67 m_value = attr->value().toDouble(&ok);
 68 if (!ok || m_value < 0)
 69 m_value = 0;
 70 } else if (attr->name() == maxAttr) {
 71 bool ok;
 72 m_max = attr->value().toDouble(&ok);
 73 if (!ok || m_max <= 0)
 74 m_max = 1;
 75 } else
 76 HTMLFormControlElement::parseMappedAttribute(attr);
 77}
 78
 79double HTMLProgressElement::value() const
 80{
 81 if (!m_isDeterminate)
 82 return 1;
 83 if (m_value > m_max)
 84 return m_max;
 85 if (m_value >= 0)
 86 return m_value;
 87 return 0;
 88}
 89
 90void HTMLProgressElement::setValue(double value)
 91{
 92 m_value = value;
 93 m_isDeterminate = true;
 94}
 95
 96double HTMLProgressElement::max() const
 97{
 98 return m_max;
 99}
 100
 101void HTMLProgressElement::setMax(double max)
 102{
 103 m_max = max > 0 ? max : 1;
 104}
 105
 106double HTMLProgressElement::position() const
 107{
 108 if (m_isDeterminate)
 109 return value() / max();
 110 return -1;
 111}
 112
 113} // namespace
 114#endif
0

WebCore/html/HTMLProgressElement.h

 1/*
 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Library General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Library General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Library General Public License
 15 * along with this library; see the file COPYING.LIB. If not, write to
 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17 * Boston, MA 02110-1301, USA.
 18 *
 19 */
 20
 21#ifndef HTMLProgressElement_h
 22#define HTMLProgressElement_h
 23
 24#if ENABLE(PROGRESS_TAG)
 25#include "HTMLFormControlElement.h"
 26
 27namespace WebCore {
 28
 29class HTMLProgressElement : public HTMLFormControlElement {
 30public:
 31 static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*, HTMLFormElement* = 0);
 32
 33 double value() const;
 34 void setValue(double);
 35
 36 double max() const;
 37 void setMax(double);
 38
 39 double position() const;
 40
 41private:
 42 HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
 43
 44 virtual bool isOptionalFormControl() const { return true; }
 45
 46 virtual const AtomicString& formControlType() const;
 47
 48 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
 49
 50 virtual void parseMappedAttribute(MappedAttribute*);
 51
 52 double m_value;
 53 double m_max;
 54 bool m_isDeterminate;
 55};
 56
 57} // namespace
 58
 59#endif
 60#endif
0

WebCore/html/HTMLProgressElement.idl

 1/*
 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Library General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Library General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Library General Public License
 15 * along with this library; see the file COPYING.LIB. If not, write to
 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17 * Boston, MA 02110-1301, USA.
 18 */
 19
 20module html {
 21 interface [
 22 Conditional=PROGRESS_TAG
 23 ] HTMLProgressElement : HTMLElement {
 24 attribute double value;
 25 attribute double max;
 26 readonly attribute double position;
 27 readonly attribute HTMLFormElement form;
 28 // readonly attribute NodeList labels;
 29 };
 30
 31}
0

WebCore/html/HTMLTagNames.in

@@p interfaceName=HTMLParagraphElement, cr
9090param createWithNew
9191plaintext interfaceName=HTMLElement
9292pre createWithNew
 93progress interfaceName=HTMLProgressElement, conditional=PROGRESS_TAG
9394q interfaceName=HTMLQuoteElement, createWithNew
9495rp interfaceName=HTMLElement, conditional=RUBY
9596rt interfaceName=HTMLElement, conditional=RUBY
55826

WebCore/page/DOMWindow.idl

@@module window {
420420 attribute HTMLParagraphElementConstructor HTMLParagraphElement;
421421 attribute HTMLParamElementConstructor HTMLParamElement;
422422 attribute HTMLPreElementConstructor HTMLPreElement;
 423#if defined(ENABLE_PROGRESS_TAG) && ENABLE_PROGRESS_TAG
 424 attribute HTMLProgressElementConstructor HTMLProgressElement;
 425#endif
423426 attribute HTMLQuoteElementConstructor HTMLQuoteElement;
424427 attribute HTMLScriptElementConstructor HTMLScriptElement;
425428 attribute HTMLSelectElementConstructor HTMLSelectElement;
55826

WebCore/platform/ThemeTypes.h

@@enum ControlPart {
5252 MediaSeekForwardButtonPart, MediaRewindButtonPart, MediaReturnToRealtimeButtonPart, MediaToggleClosedCaptionsButtonPart,
5353 MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart,
5454 MediaControlsBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart,
55  MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart,
 55 MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart, ProgressBarPart,
5656 SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
5757 SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
5858 SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
55826

WebCore/platform/qt/RenderThemeQt.cpp

4141#include "GraphicsContext.h"
4242#include "HTMLInputElement.h"
4343#include "HTMLMediaElement.h"
 44#if ENABLE(PROGRESS_TAG)
 45#include "HTMLProgressElement.h"
 46#endif
4447#include "HTMLNames.h"
4548#include "NotImplemented.h"
4649#include "Page.h"
4750#include "QWebPageClient.h"
4851#include "RenderBox.h"
 52#if ENABLE(PROGRESS_TAG)
 53#include "RenderProgress.h"
 54#endif
4955#include "RenderSlider.h"
5056#include "RenderTheme.h"
5157#include "TimeRanges.h"

6369#include <QStyleFactory>
6470#include <QStyleOptionButton>
6571#include <QStyleOptionFrameV2>
 72#if ENABLE(PROGRESS_TAG)
 73#include <QStyleOptionProgressBarV2>
 74#endif
6675#include <QStyleOptionSlider>
6776#include <QWidget>
6877

@@bool RenderThemeQt::paintMenuListButton(
632641 return false;
633642}
634643
 644#if ENABLE(PROGRESS_TAG)
 645void RenderThemeQt::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
 646{
 647 style->setBoxShadow(0);
 648}
 649
 650bool RenderThemeQt::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& pi, const IntRect& r)
 651{
 652 StylePainter p(this, pi);
 653 if (!p.isValid())
 654 return true;
 655
 656 QStyleOptionProgressBarV2 option;
 657 if (p.widget)
 658 option.initFrom(p.widget);
 659 initializeCommonQStyleOptions(option, o);
 660
 661 RenderProgress* renderProgress = toRenderProgress(o);
 662 HTMLProgressElement* element = static_cast<HTMLProgressElement*>(renderProgress->node());
 663 option.rect = r;
 664 option.maximum = element->max();
 665 option.minimum = 0;
 666 option.progress = element->value();
 667
 668 const QPoint topLeft = r.topLeft();
 669 p.painter->translate(topLeft);
 670 option.rect.moveTo(QPoint(0, 0));
 671 option.rect.setSize(r.size());
 672
 673 p.drawControl(QStyle::CE_ProgressBar, option);
 674 p.painter->translate(-topLeft);
 675
 676 return false;
 677}
 678#endif
 679
635680bool RenderThemeQt::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& pi,
636681 const IntRect& r)
637682{
55826

WebCore/platform/qt/RenderThemeQt.h

@@protected:
101101 virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
102102 virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
103103
 104#if ENABLE(PROGRESS_TAG)
 105 virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
 106 virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
 107#endif
 108
104109 virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
105110 virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
106111
55826

WebCore/rendering/RenderObject.h

@@public:
277277 virtual bool isListMarker() const { return false; }
278278 virtual bool isMedia() const { return false; }
279279 virtual bool isMenuList() const { return false; }
 280#if ENABLE(PROGRESS_TAG)
 281 virtual bool isProgress() const { return false; }
 282#endif
280283 virtual bool isRenderBlock() const { return false; }
281284 virtual bool isRenderButton() const { return false; }
282285 virtual bool isRenderImage() const { return false; }
55826

WebCore/rendering/RenderProgress.cpp

 1/*
 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Library General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Library General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Library General Public License
 15 * along with this library; see the file COPYING.LIB. If not, write to
 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17 * Boston, MA 02110-1301, USA.
 18 *
 19 */
 20
 21#include "config.h"
 22#if ENABLE(PROGRESS_TAG)
 23
 24#include "RenderProgress.h"
 25
 26#include "HTMLProgressElement.h"
 27#include "RenderTheme.h"
 28
 29using namespace std;
 30
 31namespace WebCore {
 32
 33using namespace HTMLNames;
 34
 35static const int defaultProgressWidth = 120;
 36static const int defaultProgressHeight = 20;
 37
 38RenderProgress::RenderProgress(Element* element)
 39 : RenderBlock(element)
 40{
 41 setSize(QSize(defaultProgressWidth, defaultProgressHeight));
 42 setReplaced(true);
 43}
 44
 45int RenderProgress::baselinePosition(bool, bool) const
 46{
 47 return height() + marginTop();
 48}
 49
 50void RenderProgress::calcPrefWidths()
 51{
 52 m_minPrefWidth = 0;
 53 m_maxPrefWidth = 0;
 54
 55 if (style()->width().isFixed() && style()->width().value() > 0)
 56 m_minPrefWidth = m_maxPrefWidth = calcContentBoxWidth(style()->width().value());
 57 else
 58 m_maxPrefWidth = defaultProgressWidth * style()->effectiveZoom();
 59
 60 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
 61 m_maxPrefWidth = max(m_maxPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
 62 m_minPrefWidth = max(m_minPrefWidth, calcContentBoxWidth(style()->minWidth().value()));
 63 } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
 64 m_minPrefWidth = 0;
 65 else
 66 m_minPrefWidth = m_maxPrefWidth;
 67
 68 if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
 69 m_maxPrefWidth = min(m_maxPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
 70 m_minPrefWidth = min(m_minPrefWidth, calcContentBoxWidth(style()->maxWidth().value()));
 71 }
 72
 73 int toAdd = paddingLeft() + paddingRight() + borderLeft() + borderRight();
 74 m_minPrefWidth += toAdd;
 75 m_maxPrefWidth += toAdd;
 76
 77 setPrefWidthsDirty(false);
 78}
 79
 80void RenderProgress::layout()
 81{
 82 ASSERT(needsLayout());
 83
 84 LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
 85
 86 calcWidth();
 87 calcHeight();
 88
 89 m_overflow.clear();
 90
 91 repainter.repaintAfterLayout();
 92
 93 setNeedsLayout(false);
 94}
 95
 96void RenderProgress::updateFromElement()
 97{
 98 setNeedsLayoutAndPrefWidthsRecalc();
 99}
 100
 101} // namespace WebCore
 102#endif
0

WebCore/rendering/RenderProgress.h

 1/*
 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Library General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Library General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Library General Public License
 15 * along with this library; see the file COPYING.LIB. If not, write to
 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17 * Boston, MA 02110-1301, USA.
 18 *
 19 */
 20
 21#ifndef RenderProgress_h
 22#define RenderProgress_h
 23
 24#if ENABLE(PROGRESS_TAG)
 25#include "RenderBlock.h"
 26
 27namespace WebCore {
 28class RenderProgress : public RenderBlock {
 29public:
 30 RenderProgress(Element*);
 31
 32private:
 33 virtual const char* renderName() const { return "RenderProgress"; }
 34 virtual bool isProgress() const { return true; }
 35 virtual int baselinePosition(bool, bool) const;
 36 virtual void calcPrefWidths();
 37 virtual void layout();
 38 virtual void updateFromElement();
 39};
 40
 41inline RenderProgress* toRenderProgress(RenderObject* object)
 42{
 43 ASSERT(!object || object->isProgress());
 44 return static_cast<RenderProgress*>(object);
 45}
 46
 47// This will catch anyone doing an unnecessary cast.
 48void toRenderProgress(const RenderProgress*);
 49
 50} // namespace WebCore
 51
 52#endif
 53
 54#endif // RenderProgress_h
 55
0

WebCore/rendering/RenderTheme.cpp

@@void RenderTheme::adjustStyle(CSSStyleSe
209209 return adjustSearchFieldResultsDecorationStyle(selector, style, e);
210210 case SearchFieldResultsButtonPart:
211211 return adjustSearchFieldResultsButtonStyle(selector, style, e);
 212#if ENABLE(PROGRESS_TAG)
 213 case ProgressBarPart:
 214 return adjustProgressBarStyle(selector, style, e);
 215#endif
212216 default:
213217 break;
214218 }

@@bool RenderTheme::paint(RenderObject* o,
267271#endif
268272 case MenulistPart:
269273 return paintMenuList(o, paintInfo, r);
 274#if ENABLE(PROGRESS_TAG)
 275 case ProgressBarPart:
 276 return paintProgressBar(o, paintInfo, r);
 277#endif
270278 case SliderHorizontalPart:
271279 case SliderVerticalPart:
272280 return paintSliderTrack(o, paintInfo, r);

@@bool RenderTheme::paintBorderOnly(Render
357365 case DefaultButtonPart:
358366 case ButtonPart:
359367 case MenulistPart:
 368#if ENABLE(PROGRESS_TAG)
 369 case ProgressBarPart:
 370#endif
360371 case SliderHorizontalPart:
361372 case SliderVerticalPart:
362373 case SliderThumbHorizontalPart:

@@bool RenderTheme::paintDecorations(Rende
392403 case DefaultButtonPart:
393404 case ButtonPart:
394405 case MenulistPart:
 406#if ENABLE(PROGRESS_TAG)
 407 case ProgressBarPart:
 408#endif
395409 case SliderHorizontalPart:
396410 case SliderVerticalPart:
397411 case SliderThumbHorizontalPart:

@@void RenderTheme::adjustMenuListStyle(CS
825839{
826840}
827841
 842#if ENABLE(PROGRESS_TAG)
 843void RenderTheme::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const
 844{
 845}
 846#endif
 847
828848void RenderTheme::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const
829849{
830850}
55826

WebCore/rendering/RenderTheme.h

@@protected:
227227 virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
228228 virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
229229
 230#if ENABLE(PROGRESS_TAG)
 231 virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
 232 virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
 233#endif
 234
230235 virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
231236 virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
232237
55826

LayoutTests/ChangeLog

 12010-03-09 Yael Aharon <yael.aharon@nokia.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Support for HTMLProgressElement
 6 https://bugs.webkit.org/show_bug.cgi?id=35937
 7
 8 * fast/dom/HTMLProgressElement: Added.
 9 * fast/dom/HTMLProgressElement/progress-element.html: Added.
 10 * fast/dom/HTMLProgressElement/script-tests: Added.
 11 * fast/dom/HTMLProgressElement/script-tests/TEMPLATE.html: Added.
 12 * fast/dom/HTMLProgressElement/script-tests/set-progress-properties.js: Added.
 13 * fast/dom/HTMLProgressElement/set-progress-properties.html: Added.
 14 * platform/gtk/Skipped:
 15 * platform/mac/Skipped:
 16 * platform/qt/fast/dom/HTMLProgressElement: Added.
 17 * platform/qt/fast/dom/HTMLProgressElement/progress-element-expected.checksum: Added.
 18 * platform/qt/fast/dom/HTMLProgressElement/progress-element-expected.png: Added.
 19 * platform/qt/fast/dom/HTMLProgressElement/progress-element-expected.txt: Added.
 20 * platform/qt/fast/dom/HTMLProgressElement/set-progress-properties-expected.txt: Added.
 21
1222010-03-10 Adam Barth <abarth@webkit.org>
223
324 Unreviewed.
55826

LayoutTests/fast/dom/HTMLProgressElement/progress-element.html

 1<html><body><progress value=70 max=100></progress></body></html>
0

LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
 5<script src="../../js/resources/js-test-pre.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="script-tests/set-progress-properties.js"></script>
 11<script src="../../js/resources/js-test-post.js"></script>
 12</body>
 13</html>
0

LayoutTests/fast/dom/HTMLProgressElement/script-tests/TEMPLATE.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<link rel="stylesheet" href="../../js/resources/js-test-style.css">
 5<script src="../../js/resources/js-test-pre.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="YOUR_JS_FILE_HERE"></script>
 11<script src="../../js/resources/js-test-post.js"></script>
 12</body>
 13</html>
0

LayoutTests/fast/dom/HTMLProgressElement/script-tests/set-progress-properties.js

 1description('Test setting valid and invalid properties of HTMLProgressElement.');
 2
 3var p = document.createElement('progress');
 4
 5debug("Test values before properties were set");
 6shouldBe("p.value", "1");
 7shouldBe("p.max", "1");
 8shouldBe("p.position", "-1");
 9
 10debug("Set valid values");
 11p.value = 7e1;
 12p.max = "1e2";
 13shouldBe("p.value", "70");
 14shouldBe("p.max", "100");
 15shouldBe("p.position", "0.7");
 16
 17debug("Set value bigger than max");
 18p.value = 200;
 19p.max = 100.0;
 20shouldBe("p.value", "100");
 21shouldBe("p.max", "100");
 22shouldBe("p.position", "1.0");
 23
 24debug("Set invalid value");
 25p.value = "200A";
 26p.max = 100;
 27shouldBe("p.value", "0");
 28shouldBe("p.max", "100");
 29shouldBe("p.position", "0");
 30
 31debug("Set invalid max");
 32p.value = "20";
 33p.max = "max";
 34shouldBe("p.value", "1");
 35shouldBe("p.max", "1");
 36shouldBe("p.position", "1");
 37
 38debug("Set value to null and max to 0");
 39p.value = null;
 40p.max = 0;
 41shouldBe("p.value", "0");
 42shouldBe("p.max", "1");
 43shouldBe("p.position", "0");
 44
 45var successfullyParsed = true;
0

LayoutTests/platform/gtk/Skipped

@@fast/forms/multiple-form-submission-prot
58235823# mouseScrollBy() is not yet implemented in the GTK EventSender API.
58245824fast/events/remove-child-onscroll.html
58255825
 5826# renderTheme is not ready to draw progress element
 5827fast/dom/HTMLProgressElement/progress-element.html
 5828fast/dom/HTMLProgressElement/set-progress-properties.html
 5829
58265830# Apparently a soup bug; See https://bugs.webkit.org/show_bug.cgi?id=35942
58275831http/tests/plugins/third-party-cookie-accept-policy.html
58285832
55806

LayoutTests/platform/mac/Skipped

@@fast/events/spatial-navigation
129129# For some reason crashes when run with all tests. Passes individually.
130130fast/forms/multiple-form-submission-protection-mouse.html
131131
 132
 133# renderTheme is not ready to draw progress element
 134fast/dom/HTMLProgressElement/progress-element.html
 135fast/dom/HTMLProgressElement/set-progress-properties.html
 136
132137# event.dataTransfer.setData('text/uri-list') not correctly implemented on Mac
133138editing/pasteboard/dataTransfer-setData-getData.html
 139
55826

LayoutTests/platform/qt/fast/dom/HTMLProgressElement/progress-element-expected.checksum

 101cffd99b50c78bcdf93d23f1c20cc02
02\ No newline at end of file
0

LayoutTests/platform/qt/fast/dom/HTMLProgressElement/progress-element-expected.txt

 1layer at (0,0) size 800x600
 2 RenderView at (0,0) size 800x600
 3layer at (0,0) size 800x600
 4 RenderBlock {HTML} at (0,0) size 800x600
 5 RenderBody {BODY} at (8,8) size 784x584
 6 RenderProgress {PROGRESS} at (2,2) size 120x20
 7 RenderText {#text} at (0,0) size 0x0
0

LayoutTests/platform/qt/fast/dom/HTMLProgressElement/set-progress-properties-expected.txt

 1Test setting valid and invalid properties of HTMLProgressElement.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Test values before properties were set
 7PASS p.value is 1
 8PASS p.max is 1
 9PASS p.position is -1
 10Set valid values
 11PASS p.value is 70
 12PASS p.max is 100
 13PASS p.position is 0.7
 14Set value bigger than max
 15PASS p.value is 100
 16PASS p.max is 100
 17PASS p.position is 1.0
 18Set invalid value
 19PASS p.value is 0
 20PASS p.max is 100
 21PASS p.position is 0
 22Set invalid max
 23PASS p.value is 1
 24PASS p.max is 1
 25PASS p.position is 1
 26Set value to null and max to 0
 27PASS p.value is 0
 28PASS p.max is 1
 29PASS p.position is 0
 30PASS successfullyParsed is true
 31
 32TEST COMPLETE
 33
0

LayoutTests/platform/qt/fast/dom/HTMLProgressElement/progress-element-expected.png

INVALID: Image lacks a checksum. This will fail with a MISSING error in run-webkit-tests. Always generate new png files using run-webkit-tests.