diff options
Diffstat (limited to 'Source/WebCore/html')
222 files changed, 4521 insertions, 3713 deletions
diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.cpp b/Source/WebCore/html/BaseDateAndTimeInputType.cpp index 4b7f93cf0..44c3a83d7 100644 --- a/Source/WebCore/html/BaseDateAndTimeInputType.cpp +++ b/Source/WebCore/html/BaseDateAndTimeInputType.cpp @@ -34,7 +34,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "KeyboardEvent.h" -#include "LocalizedDate.h" +#include "Localizer.h" #include <limits> #include <wtf/CurrentTime.h> #include <wtf/DateMath.h> @@ -156,7 +156,7 @@ String BaseDateAndTimeInputType::localizeValue(const String& proposedValue) cons if (!parseToDateComponents(proposedValue, &date)) return proposedValue; - String localized = formatLocalizedDate(date); + String localized = element()->localizer().formatDateTime(date); return localized.isEmpty() ? proposedValue : localized; } @@ -170,7 +170,7 @@ String BaseDateAndTimeInputType::convertFromVisibleValue(const String& visibleVa if (visibleValue.isEmpty()) return visibleValue; - double parsedValue = parseLocalizedDate(visibleValue, dateType()); + double parsedValue = element()->localizer().parseDateTime(visibleValue, dateType()); if (!isfinite(parsedValue)) return visibleValue; diff --git a/Source/WebCore/html/BaseDateAndTimeInputType.h b/Source/WebCore/html/BaseDateAndTimeInputType.h index a49910fde..96b7b5fe6 100644 --- a/Source/WebCore/html/BaseDateAndTimeInputType.h +++ b/Source/WebCore/html/BaseDateAndTimeInputType.h @@ -44,12 +44,13 @@ protected: virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE; virtual Decimal parseToNumber(const String&, const Decimal&) const OVERRIDE; virtual bool parseToDateComponents(const String&, DateComponents*) const OVERRIDE; + virtual String sanitizeValue(const String&) const OVERRIDE; virtual String serialize(const Decimal&) const OVERRIDE; String serializeWithComponents(const DateComponents&) const; + virtual bool setMillisecondToDateComponents(double, DateComponents*) const = 0; private: virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const = 0; - virtual bool setMillisecondToDateComponents(double, DateComponents*) const = 0; virtual DateComponents::Type dateType() const = 0; virtual double valueAsDate() const OVERRIDE; virtual void setValueAsDate(double, ExceptionCode&) const OVERRIDE; @@ -63,7 +64,6 @@ private: virtual String localizeValue(const String&) const OVERRIDE; virtual String visibleValue() const OVERRIDE; virtual String convertFromVisibleValue(const String&) const OVERRIDE; - virtual String sanitizeValue(const String&) const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp b/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp new file mode 100644 index 000000000..962e278cd --- /dev/null +++ b/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp @@ -0,0 +1,362 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +#include "BaseMultipleFieldsDateAndTimeInputType.h" + +#include "CSSValueKeywords.h" +#include "DateComponents.h" +#include "DateTimeFieldsState.h" +#include "ElementShadow.h" +#include "FormController.h" +#include "HTMLDataListElement.h" +#include "HTMLInputElement.h" +#include "HTMLOptionElement.h" +#include "KeyboardEvent.h" +#include "Localizer.h" +#include "Page.h" +#include "PickerIndicatorElement.h" +#include "RenderTheme.h" +#include "ShadowRoot.h" +#include <wtf/DateMath.h> + +namespace WebCore { + +void BaseMultipleFieldsDateAndTimeInputType::didBlurFromControl() +{ + // We don't need to call blur(). This function is called when control + // lost focus. + + // Remove focus ring by CSS "focus" pseudo class. + element()->setFocus(false); +} + +void BaseMultipleFieldsDateAndTimeInputType::didFocusOnControl() +{ + // We don't need to call focus(). This function is called when control + // got focus. + + // Add focus ring by CSS "focus" pseudo class. + element()->setFocus(true); +} + +void BaseMultipleFieldsDateAndTimeInputType::editControlValueChanged() +{ + RefPtr<HTMLInputElement> input(element()); + input->setValueInternal(sanitizeValue(m_dateTimeEditElement->value()), DispatchNoEvent); + input->setNeedsStyleRecalc(); + input->dispatchFormControlInputEvent(); + input->dispatchFormControlChangeEvent(); + input->notifyFormStateChanged(); +} + +bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const +{ + return false; +} + +bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled() const +{ + return element()->readOnly(); +} + +bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerReadOnly() const +{ + return element()->disabled(); +} + +BaseMultipleFieldsDateAndTimeInputType::BaseMultipleFieldsDateAndTimeInputType(HTMLInputElement* element) + : BaseDateAndTimeInputType(element) + , m_dateTimeEditElement(0) + , m_pickerIndicatorElement(0) + , m_pickerIndicatorIsVisible(false) + , m_pickerIndicatorIsAlwaysVisible(false) +{ +} + +BaseMultipleFieldsDateAndTimeInputType::~BaseMultipleFieldsDateAndTimeInputType() +{ + if (m_dateTimeEditElement) + m_dateTimeEditElement->removeEditControlOwner(); +} + +void BaseMultipleFieldsDateAndTimeInputType::blur() +{ + if (m_dateTimeEditElement) + m_dateTimeEditElement->blurByOwner(); +} + +RenderObject* BaseMultipleFieldsDateAndTimeInputType::createRenderer(RenderArena* arena, RenderStyle* style) const +{ + return InputType::createRenderer(arena, style); +} + +void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree() +{ + DEFINE_STATIC_LOCAL(AtomicString, dateAndTimeInputContainerPseudoId, ("-webkit-date-and-time-container", AtomicString::ConstructFromLiteral)); + + ASSERT(element()->shadow()); + + Document* document = element()->document(); + RefPtr<HTMLDivElement> container = HTMLDivElement::create(document); + element()->userAgentShadowRoot()->appendChild(container); + container->setShadowPseudoId(dateAndTimeInputContainerPseudoId); + + RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(document, *this)); + m_dateTimeEditElement = dateTimeEditElement.get(); + container->appendChild(m_dateTimeEditElement); + updateInnerTextValue(); + +#if ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER) + bool shouldAddPickerIndicator = false; +#if ENABLE(DATALIST_ELEMENT) + if (InputType::themeSupportsDataListUI(this)) + shouldAddPickerIndicator = true; +#endif +#if ENABLE(CALENDAR_PICKER) + RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme(); + if (theme->supportsCalendarPicker(formControlType())) { + shouldAddPickerIndicator = true; + m_pickerIndicatorIsAlwaysVisible = true; + } +#endif + if (shouldAddPickerIndicator) { + RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::create(document); + m_pickerIndicatorElement = pickerElement.get(); + container->appendChild(m_pickerIndicatorElement); + m_pickerIndicatorIsVisible = true; + updatePickerIndicatorVisibility(); + } +#endif // ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER) +} + +void BaseMultipleFieldsDateAndTimeInputType::destroyShadowSubtree() +{ + if (m_dateTimeEditElement) { + m_dateTimeEditElement->removeEditControlOwner(); + m_dateTimeEditElement = 0; + } + BaseDateAndTimeInputType::destroyShadowSubtree(); +} + +void BaseMultipleFieldsDateAndTimeInputType::focus(bool) +{ + if (m_dateTimeEditElement) + m_dateTimeEditElement->focusByOwner(); +} + +void BaseMultipleFieldsDateAndTimeInputType::forwardEvent(Event* event) +{ + if (m_dateTimeEditElement) + m_dateTimeEditElement->defaultEventHandler(event); +} + +void BaseMultipleFieldsDateAndTimeInputType::disabledAttributeChanged() +{ + if (m_dateTimeEditElement) + m_dateTimeEditElement->disabledStateChanged(); +} + +void BaseMultipleFieldsDateAndTimeInputType::handleKeydownEvent(KeyboardEvent* event) +{ + Document* document = element()->document(); + RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme(); + if (theme->shouldOpenPickerWithF4Key() && event->keyIdentifier() == "F4") { + if (m_pickerIndicatorElement) + m_pickerIndicatorElement->openPopup(); + event->setDefaultHandled(); + } else if (m_pickerIndicatorIsVisible && event->keyIdentifier() == "Down" && event->getModifierState("Alt")) { + if (m_pickerIndicatorElement) + m_pickerIndicatorElement->openPopup(); + event->setDefaultHandled(); + } else + forwardEvent(event); +} + +bool BaseMultipleFieldsDateAndTimeInputType::isKeyboardFocusable(KeyboardEvent*) const +{ + return false; +} + +bool BaseMultipleFieldsDateAndTimeInputType::isMouseFocusable() const +{ + return false; +} + +AtomicString BaseMultipleFieldsDateAndTimeInputType::localeIdentifier() const +{ + return element()->computeInheritedLanguage(); +} + +void BaseMultipleFieldsDateAndTimeInputType::minOrMaxAttributeChanged() +{ + updateInnerTextValue(); +} + +void BaseMultipleFieldsDateAndTimeInputType::readonlyAttributeChanged() +{ + if (m_dateTimeEditElement) + m_dateTimeEditElement->readOnlyStateChanged(); +} + +bool BaseMultipleFieldsDateAndTimeInputType::isTextField() const +{ + return false; +} + +void BaseMultipleFieldsDateAndTimeInputType::restoreFormControlState(const FormControlState& state) +{ + if (!m_dateTimeEditElement) + return; + DateComponents date; + setMillisecondToDateComponents(createStepRange(AnyIsDefaultStep).minimum().toDouble(), &date); + DateTimeFieldsState dateTimeFieldsState = DateTimeFieldsState::restoreFormControlState(state); + m_dateTimeEditElement->setValueAsDateTimeFieldsState(dateTimeFieldsState, date); + element()->setValueInternal(sanitizeValue(m_dateTimeEditElement->value()), DispatchNoEvent); +} + +FormControlState BaseMultipleFieldsDateAndTimeInputType::saveFormControlState() const +{ + if (!m_dateTimeEditElement) + return FormControlState(); + + return m_dateTimeEditElement->valueAsDateTimeFieldsState().saveFormControlState(); +} + +void BaseMultipleFieldsDateAndTimeInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior) +{ + InputType::setValue(sanitizedValue, valueChanged, eventBehavior); + if (valueChanged) + updateInnerTextValue(); +} + +bool BaseMultipleFieldsDateAndTimeInputType::shouldUseInputMethod() const +{ + return false; +} + +void BaseMultipleFieldsDateAndTimeInputType::stepAttributeChanged() +{ + updateInnerTextValue(); +} + +void BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue() +{ + if (!m_dateTimeEditElement) + return; + + AtomicString direction = element()->localizer().isRTL() ? AtomicString("rtl", AtomicString::ConstructFromLiteral) : AtomicString("ltr", AtomicString::ConstructFromLiteral); + if (Element* container = firstElementChild(element()->userAgentShadowRoot())) + container->setAttribute(HTMLNames::dirAttr, direction); + + DateTimeEditElement::LayoutParameters layoutParameters(element()->localizer(), createStepRange(AnyIsDefaultStep)); + + DateComponents date; + const bool hasValue = parseToDateComponents(element()->value(), &date); + if (!hasValue) + setMillisecondToDateComponents(layoutParameters.stepRange.minimum().toDouble(), &date); + + setupLayoutParameters(layoutParameters, date); + + if (hasValue) + m_dateTimeEditElement->setValueAsDate(layoutParameters, date); + else + m_dateTimeEditElement->setEmptyValue(layoutParameters, date); +} + +#if ENABLE(DATALIST_ELEMENT) +void BaseMultipleFieldsDateAndTimeInputType::listAttributeTargetChanged() +{ + updatePickerIndicatorVisibility(); +} +#endif + +#if ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER) +void BaseMultipleFieldsDateAndTimeInputType::updatePickerIndicatorVisibility() +{ +#if ENABLE(CALENDAR_PICKER) + if (m_pickerIndicatorIsAlwaysVisible) { + showPickerIndicator(); + return; + } +#endif +#if ENABLE(DATALIST_ELEMENT) + if (HTMLDataListElement* dataList = element()->dataList()) { + RefPtr<HTMLCollection> options = dataList->options(); + for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options->item(i)); ++i) { + if (element()->isValidValue(option->value())) { + showPickerIndicator(); + return; + } + } + } + hidePickerIndicator(); +#endif +} + +void BaseMultipleFieldsDateAndTimeInputType::hidePickerIndicator() +{ + if (!m_pickerIndicatorIsVisible) + return; + m_pickerIndicatorIsVisible = false; + ASSERT(m_pickerIndicatorElement); + m_pickerIndicatorElement->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); +} + +void BaseMultipleFieldsDateAndTimeInputType::showPickerIndicator() +{ + if (m_pickerIndicatorIsVisible) + return; + m_pickerIndicatorIsVisible = true; + ASSERT(m_pickerIndicatorElement); + m_pickerIndicatorElement->removeInlineStyleProperty(CSSPropertyDisplay); +} +#endif // ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER) + +int BaseMultipleFieldsDateAndTimeInputType::fullYear(const String& source) const +{ + DateComponents date; + if (!parseToDateComponents(source, &date)) + return DateTimeEditElement::LayoutParameters::undefinedYear(); + return date.fullYear(); +} + +bool BaseMultipleFieldsDateAndTimeInputType::shouldHaveSecondField(const DateComponents& date) const +{ + StepRange stepRange = createStepRange(AnyIsDefaultStep); + return date.second() + || !stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero() + || !stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); +} + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h b/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h new file mode 100644 index 000000000..319330438 --- /dev/null +++ b/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef BaseMultipleFieldsDateAndTimeInputType_h +#define BaseMultipleFieldsDateAndTimeInputType_h + +#include "BaseDateAndTimeInputType.h" + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +#include "DateTimeEditElement.h" + +namespace WebCore { + +class PickerIndicatorElement; + +class BaseMultipleFieldsDateAndTimeInputType : public BaseDateAndTimeInputType, protected DateTimeEditElement::EditControlOwner { +protected: + BaseMultipleFieldsDateAndTimeInputType(HTMLInputElement*); + virtual ~BaseMultipleFieldsDateAndTimeInputType(); + + int fullYear(const String&) const; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const = 0; + bool shouldHaveSecondField(const DateComponents&) const; + +private: + // DateTimeEditElement::EditControlOwner functions + virtual void didBlurFromControl() OVERRIDE FINAL; + virtual void didFocusOnControl() OVERRIDE FINAL; + virtual void editControlValueChanged() OVERRIDE FINAL; + virtual bool isEditControlOwnerDisabled() const OVERRIDE FINAL; + virtual bool isEditControlOwnerReadOnly() const OVERRIDE FINAL; + virtual AtomicString localeIdentifier() const OVERRIDE FINAL; + + // InputType functions + virtual void blur() OVERRIDE FINAL; + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE FINAL; + virtual void createShadowSubtree() OVERRIDE FINAL; + virtual void destroyShadowSubtree() OVERRIDE FINAL; + virtual void disabledAttributeChanged() OVERRIDE FINAL; + virtual void focus(bool restorePreviousSelection) OVERRIDE FINAL; + virtual void forwardEvent(Event*) OVERRIDE FINAL; + virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE FINAL; + virtual bool hasCustomFocusLogic() const OVERRIDE FINAL; + virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE FINAL; + virtual bool isMouseFocusable() const OVERRIDE FINAL; + virtual bool isTextField() const OVERRIDE FINAL; + virtual void minOrMaxAttributeChanged() OVERRIDE FINAL; + virtual void readonlyAttributeChanged() OVERRIDE FINAL; + virtual void restoreFormControlState(const FormControlState&) OVERRIDE FINAL; + virtual FormControlState saveFormControlState() const OVERRIDE FINAL; + virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE FINAL; + virtual bool shouldUseInputMethod() const OVERRIDE FINAL; + virtual void stepAttributeChanged() OVERRIDE FINAL; + virtual void updateInnerTextValue() OVERRIDE FINAL; + virtual void listAttributeTargetChanged() OVERRIDE FINAL; + + void showPickerIndicator(); + void hidePickerIndicator(); + void updatePickerIndicatorVisibility(); + + DateTimeEditElement* m_dateTimeEditElement; +#if ENABLE(DATALIST_ELEMENT) || ENABLE(CALENDAR_PICKER) + PickerIndicatorElement* m_pickerIndicatorElement; + bool m_pickerIndicatorIsVisible; +#if ENABLE(CALENDAR_PICKER) + bool m_pickerIndicatorIsAlwaysVisible; +#endif +#endif +}; + +} // namespace WebCore + +#endif +#endif // TimeInputType_h diff --git a/Source/WebCore/html/ClassList.cpp b/Source/WebCore/html/ClassList.cpp index a325a1226..5ff3bdaf6 100644 --- a/Source/WebCore/html/ClassList.cpp +++ b/Source/WebCore/html/ClassList.cpp @@ -25,21 +25,17 @@ #include "config.h" #include "ClassList.h" -#include "Element.h" -#include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "SpaceSplitString.h" #include <wtf/text/StringBuilder.h> namespace WebCore { -using namespace HTMLNames; - ClassList::ClassList(Element* element) : m_element(element) { if (m_element->document()->inQuirksMode()) - m_classNamesForQuirksMode.set(m_element->getAttribute(classAttr), false); + m_classNamesForQuirksMode.set(value(), false); } void ClassList::ref() @@ -64,71 +60,11 @@ const AtomicString ClassList::item(unsigned index) const return classNames()[index]; } -bool ClassList::contains(const AtomicString& token, ExceptionCode& ec) const -{ - if (!validateToken(token, ec)) - return false; - return containsInternal(token); -} - bool ClassList::containsInternal(const AtomicString& token) const { return m_element->hasClass() && classNames().contains(token); } -void ClassList::add(const AtomicString& token, ExceptionCode& ec) -{ - if (!validateToken(token, ec)) - return; - addInternal(token); -} - -void ClassList::addInternal(const AtomicString& token) -{ - const AtomicString& oldClassName(m_element->getAttribute(classAttr)); - if (oldClassName.isEmpty()) - m_element->setAttribute(classAttr, token); - else if (!containsInternal(token)) { - const AtomicString& newClassName(addToken(oldClassName, token)); - m_element->setAttribute(classAttr, newClassName); - } -} - -void ClassList::remove(const AtomicString& token, ExceptionCode& ec) -{ - if (!validateToken(token, ec)) - return; - removeInternal(token); -} - -void ClassList::removeInternal(const AtomicString& token) -{ - // Check using contains first since it uses AtomicString comparisons instead - // of character by character testing. - if (!containsInternal(token)) - return; - const AtomicString& newClassName(removeToken(m_element->getAttribute(classAttr), token)); - m_element->setAttribute(classAttr, newClassName); -} - -bool ClassList::toggle(const AtomicString& token, ExceptionCode& ec) -{ - if (!validateToken(token, ec)) - return false; - - if (containsInternal(token)) { - removeInternal(token); - return false; - } - addInternal(token); - return true; -} - -String ClassList::toString() const -{ - return m_element->getAttribute(classAttr); -} - void ClassList::reset(const String& newClassName) { if (m_element->document()->inQuirksMode()) diff --git a/Source/WebCore/html/ClassList.h b/Source/WebCore/html/ClassList.h index 992fad474..5e339c045 100644 --- a/Source/WebCore/html/ClassList.h +++ b/Source/WebCore/html/ClassList.h @@ -26,11 +26,17 @@ #define ClassList_h #include "DOMTokenList.h" +#include "Element.h" +#include "HTMLNames.h" #include "SpaceSplitString.h" #include <wtf/PassOwnPtr.h> +#include <wtf/Vector.h> + namespace WebCore { +using namespace HTMLNames; + class Element; typedef int ExceptionCode; @@ -42,30 +48,26 @@ public: return adoptPtr(new ClassList(element)); } - virtual void ref(); - virtual void deref(); + virtual void ref() OVERRIDE; + virtual void deref() OVERRIDE; - virtual unsigned length() const; - virtual const AtomicString item(unsigned index) const; - virtual bool contains(const AtomicString&, ExceptionCode&) const; - virtual void add(const AtomicString&, ExceptionCode&); - virtual void remove(const AtomicString&, ExceptionCode&); - virtual bool toggle(const AtomicString&, ExceptionCode&); - virtual String toString() const; + virtual unsigned length() const OVERRIDE; + virtual const AtomicString item(unsigned index) const OVERRIDE; - virtual Element* element() { return m_element; } + virtual Element* element() OVERRIDE { return m_element; } void reset(const String&); private: ClassList(Element*); - void addInternal(const AtomicString&); - bool containsInternal(const AtomicString&) const; - void removeInternal(const AtomicString&); + virtual bool containsInternal(const AtomicString&) const OVERRIDE; const SpaceSplitString& classNames() const; + virtual AtomicString value() const OVERRIDE { return m_element->getAttribute(classAttr); } + virtual void setValue(const AtomicString& value) OVERRIDE { m_element->setAttribute(classAttr, value); } + Element* m_element; SpaceSplitString m_classNamesForQuirksMode; }; diff --git a/Source/WebCore/html/DOMFormData.idl b/Source/WebCore/html/DOMFormData.idl index 73eaa6618..cf16babdb 100644 --- a/Source/WebCore/html/DOMFormData.idl +++ b/Source/WebCore/html/DOMFormData.idl @@ -28,20 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + CustomConstructor, + ConstructorParameters=1, + JSGenerateToNativeObject, + JSGenerateToJSObject, + InterfaceName=FormData +] interface DOMFormData { + // void append(DOMString name, DOMString value); + // void append(DOMString name, Blob value, optional DOMString filename); + [Custom] void append(in [Optional=DefaultIsUndefined] DOMString name, + in [Optional=DefaultIsUndefined] DOMString value, + in [Optional=DefaultIsUndefined] DOMString filename); +}; - interface [ - CustomConstructor, - ConstructorParameters=1, - JSGenerateToNativeObject, - JSGenerateToJSObject, - InterfaceName=FormData - ] DOMFormData { - // void append(DOMString name, DOMString value); - // void append(DOMString name, Blob value, optional DOMString filename); - [Custom] void append(in [Optional=DefaultIsUndefined] DOMString name, - in [Optional=DefaultIsUndefined] DOMString value, - in [Optional=DefaultIsUndefined] DOMString filename); - }; - -} diff --git a/Source/WebCore/html/DOMSettableTokenList.cpp b/Source/WebCore/html/DOMSettableTokenList.cpp index 3a86e9c00..4ef0f7f51 100644 --- a/Source/WebCore/html/DOMSettableTokenList.cpp +++ b/Source/WebCore/html/DOMSettableTokenList.cpp @@ -44,55 +44,46 @@ const AtomicString DOMSettableTokenList::item(unsigned index) const return m_tokens[index]; } -bool DOMSettableTokenList::contains(const AtomicString& token, ExceptionCode& ec) const +bool DOMSettableTokenList::containsInternal(const AtomicString& token) const { - if (!validateToken(token, ec)) - return false; return m_tokens.contains(token); } -void DOMSettableTokenList::add(const AtomicString& token, ExceptionCode& ec) +void DOMSettableTokenList::add(const Vector<String>& tokens, ExceptionCode& ec) { - if (!validateToken(token, ec) || m_tokens.contains(token)) - return; - addInternal(token); + DOMTokenList::add(tokens, ec); + + for (size_t i = 0; i < tokens.size(); ++i) { + if (m_tokens.isNull()) + m_tokens.set(tokens[i], false); + else + m_tokens.add(tokens[i]); + } } void DOMSettableTokenList::addInternal(const AtomicString& token) { - m_value = addToken(m_value, token); + DOMTokenList::addInternal(token); if (m_tokens.isNull()) m_tokens.set(token, false); else m_tokens.add(token); } -void DOMSettableTokenList::remove(const AtomicString& token, ExceptionCode& ec) +void DOMSettableTokenList::remove(const Vector<String>& tokens, ExceptionCode& ec) { - if (!validateToken(token, ec) || !m_tokens.contains(token)) - return; - removeInternal(token); + DOMTokenList::remove(tokens, ec); + for (size_t i = 0; i < tokens.size(); ++i) + m_tokens.remove(tokens[i]); } void DOMSettableTokenList::removeInternal(const AtomicString& token) { - m_value = removeToken(m_value, token); + DOMTokenList::removeInternal(token); m_tokens.remove(token); } -bool DOMSettableTokenList::toggle(const AtomicString& token, ExceptionCode& ec) -{ - if (!validateToken(token, ec)) - return false; - if (m_tokens.contains(token)) { - removeInternal(token); - return false; - } - addInternal(token); - return true; -} - -void DOMSettableTokenList::setValue(const String& value) +void DOMSettableTokenList::setValue(const AtomicString& value) { m_value = value; m_tokens.set(value, false); diff --git a/Source/WebCore/html/DOMSettableTokenList.h b/Source/WebCore/html/DOMSettableTokenList.h index 0b23c6ab2..f338dc32b 100644 --- a/Source/WebCore/html/DOMSettableTokenList.h +++ b/Source/WebCore/html/DOMSettableTokenList.h @@ -44,28 +44,28 @@ public: } virtual ~DOMSettableTokenList(); - virtual void ref() { RefCounted<DOMSettableTokenList>::ref(); } - virtual void deref() { RefCounted<DOMSettableTokenList>::deref(); } + virtual void ref() OVERRIDE { RefCounted<DOMSettableTokenList>::ref(); } + virtual void deref() OVERRIDE { RefCounted<DOMSettableTokenList>::deref(); } - virtual unsigned length() const { return m_tokens.size(); } - virtual const AtomicString item(unsigned index) const; - virtual bool contains(const AtomicString&, ExceptionCode&) const; - virtual void add(const AtomicString&, ExceptionCode&); - virtual void remove(const AtomicString&, ExceptionCode&); - virtual bool toggle(const AtomicString&, ExceptionCode&); - virtual String toString() const { return value(); } + virtual unsigned length() const OVERRIDE { return m_tokens.size(); } + virtual const AtomicString item(unsigned index) const OVERRIDE; + + virtual void add(const Vector<String>&, ExceptionCode&) OVERRIDE; + virtual void remove(const Vector<String>&, ExceptionCode&) OVERRIDE; + + virtual AtomicString value() const OVERRIDE { return m_value; } + virtual void setValue(const AtomicString&) OVERRIDE; - String value() const { return m_value; } const SpaceSplitString& tokens() const { return m_tokens; } - void setValue(const String&); private: DOMSettableTokenList(); - void removeInternal(const AtomicString&); - void addInternal(const AtomicString&); + virtual void addInternal(const AtomicString&) OVERRIDE; + virtual bool containsInternal(const AtomicString&) const OVERRIDE; + virtual void removeInternal(const AtomicString&) OVERRIDE; - String m_value; + AtomicString m_value; SpaceSplitString m_tokens; }; diff --git a/Source/WebCore/html/DOMSettableTokenList.idl b/Source/WebCore/html/DOMSettableTokenList.idl index 93bf67f69..5b4d10869 100644 --- a/Source/WebCore/html/DOMSettableTokenList.idl +++ b/Source/WebCore/html/DOMSettableTokenList.idl @@ -22,13 +22,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module core { +[ + IndexedGetter, + JSGenerateToJSObject +] interface DOMSettableTokenList : DOMTokenList { + attribute DOMString value; +}; - interface [ - IndexedGetter, - JSGenerateToJSObject - ] DOMSettableTokenList : DOMTokenList { - attribute DOMString value; - }; - -} diff --git a/Source/WebCore/html/DOMTokenList.cpp b/Source/WebCore/html/DOMTokenList.cpp index 7132b1169..d555fb990 100644 --- a/Source/WebCore/html/DOMTokenList.cpp +++ b/Source/WebCore/html/DOMTokenList.cpp @@ -49,23 +49,151 @@ bool DOMTokenList::validateToken(const AtomicString& token, ExceptionCode& ec) return true; } +bool DOMTokenList::validateTokens(const Vector<String>& tokens, ExceptionCode& ec) +{ + for (size_t i = 0; i < tokens.size(); ++i) { + if (!validateToken(tokens[i], ec)) + return false; + } + + return true; +} + +bool DOMTokenList::contains(const AtomicString& token, ExceptionCode& ec) const +{ + if (!validateToken(token, ec)) + return false; + return containsInternal(token); +} + +void DOMTokenList::add(const AtomicString& token, ExceptionCode& ec) +{ + Vector<String> tokens; + tokens.append(token.string()); + add(tokens, ec); +} + +void DOMTokenList::add(const Vector<String>& tokens, ExceptionCode& ec) +{ + Vector<String> filteredTokens; + for (size_t i = 0; i < tokens.size(); ++i) { + if (!validateToken(tokens[i], ec)) + return; + if (!containsInternal(tokens[i])) + filteredTokens.append(tokens[i]); + } + + if (filteredTokens.isEmpty()) + return; + + setValue(addTokens(value(), filteredTokens)); +} + +void DOMTokenList::remove(const AtomicString& token, ExceptionCode& ec) +{ + Vector<String> tokens; + tokens.append(token.string()); + remove(tokens, ec); +} + +void DOMTokenList::remove(const Vector<String>& tokens, ExceptionCode& ec) +{ + if (!validateTokens(tokens, ec)) + return; + + // Check using containsInternal first since it is a lot faster than going + // through the string character by character. + bool found = false; + for (size_t i = 0; i < tokens.size(); ++i) { + if (containsInternal(tokens[i])) { + found = true; + break; + } + } + + if (found) + setValue(removeTokens(value(), tokens)); +} + +bool DOMTokenList::toggle(const AtomicString& token, ExceptionCode& ec) +{ + if (!validateToken(token, ec)) + return false; + + if (containsInternal(token)) { + removeInternal(token); + return false; + } + addInternal(token); + return true; +} + +bool DOMTokenList::toggle(const AtomicString& token, bool force, ExceptionCode& ec) +{ + if (!validateToken(token, ec)) + return false; + + if (force) + addInternal(token); + else + removeInternal(token); + + return force; +} + +void DOMTokenList::addInternal(const AtomicString& token) +{ + if (!containsInternal(token)) + setValue(addToken(value(), token)); +} + +void DOMTokenList::removeInternal(const AtomicString& token) +{ + // Check using contains first since it uses AtomicString comparisons instead + // of character by character testing. + if (!containsInternal(token)) + return; + setValue(removeToken(value(), token)); +} + String DOMTokenList::addToken(const AtomicString& input, const AtomicString& token) { - if (input.isEmpty()) - return token; + Vector<String> tokens; + tokens.append(token.string()); + return addTokens(input, tokens); +} + +String DOMTokenList::addTokens(const AtomicString& input, const Vector<String>& tokens) +{ + bool needsSpace = false; StringBuilder builder; - builder.append(input); - if (!isHTMLSpace(input[input.length() - 1])) - builder.append(' '); + if (!input.isEmpty()) { + builder.append(input); + needsSpace = !isHTMLSpace(input[input.length() - 1]); + } + + for (size_t i = 0; i < tokens.size(); ++i) { + if (needsSpace) + builder.append(' '); + builder.append(tokens[i]); + needsSpace = true; + } - builder.append(token); return builder.toString(); } String DOMTokenList::removeToken(const AtomicString& input, const AtomicString& token) { + Vector<String> tokens; + tokens.append(token.string()); + return removeTokens(input, tokens); +} + +String DOMTokenList::removeTokens(const AtomicString& input, const Vector<String>& tokens) +{ // Algorithm defined at http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#remove-a-token-from-a-string + // New spec is at http://dom.spec.whatwg.org/#remove-a-token-from-a-string unsigned inputLength = input.length(); StringBuilder output; // 3 @@ -85,7 +213,7 @@ String DOMTokenList::removeToken(const AtomicString& input, const AtomicString& s.append(input[position++]); // Step 8 - if (s.toStringPreserveCapacity() == token) { + if (tokens.contains(s.toStringPreserveCapacity())) { // Step 8.1 while (position < inputLength && isHTMLSpace(input[position])) ++position; diff --git a/Source/WebCore/html/DOMTokenList.h b/Source/WebCore/html/DOMTokenList.h index fd110b7ff..31fc34280 100644 --- a/Source/WebCore/html/DOMTokenList.h +++ b/Source/WebCore/html/DOMTokenList.h @@ -45,18 +45,33 @@ public: virtual unsigned length() const = 0; virtual const AtomicString item(unsigned index) const = 0; - virtual bool contains(const AtomicString&, ExceptionCode&) const = 0; - virtual void add(const AtomicString&, ExceptionCode&) = 0; - virtual void remove(const AtomicString&, ExceptionCode&) = 0; - virtual bool toggle(const AtomicString&, ExceptionCode&) = 0; - virtual String toString() const = 0; + + bool contains(const AtomicString&, ExceptionCode&) const; + virtual void add(const Vector<String>&, ExceptionCode&); + void add(const AtomicString&, ExceptionCode&); + virtual void remove(const Vector<String>&, ExceptionCode&); + void remove(const AtomicString&, ExceptionCode&); + bool toggle(const AtomicString&, ExceptionCode&); + bool toggle(const AtomicString&, bool force, ExceptionCode&); + + AtomicString toString() const { return value(); } virtual Element* element() { return 0; } protected: + virtual AtomicString value() const = 0; + virtual void setValue(const AtomicString&) = 0; + + virtual void addInternal(const AtomicString&); + virtual bool containsInternal(const AtomicString&) const = 0; + virtual void removeInternal(const AtomicString&); + static bool validateToken(const AtomicString&, ExceptionCode&); + static bool validateTokens(const Vector<String>&, ExceptionCode&); static String addToken(const AtomicString&, const AtomicString&); + static String addTokens(const AtomicString&, const Vector<String>&); static String removeToken(const AtomicString&, const AtomicString&); + static String removeTokens(const AtomicString&, const Vector<String>&); }; } // namespace WebCore diff --git a/Source/WebCore/html/DOMTokenList.idl b/Source/WebCore/html/DOMTokenList.idl index cf57e1aee..959a8ee5f 100644 --- a/Source/WebCore/html/DOMTokenList.idl +++ b/Source/WebCore/html/DOMTokenList.idl @@ -22,22 +22,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module core { - - interface [ - GenerateIsReachable=ImplElementRoot, - IndexedGetter - ] DOMTokenList { - readonly attribute unsigned long length; - [TreatReturnedNullStringAs=Null] DOMString item(in unsigned long index); - boolean contains(in DOMString token) raises(DOMException); - void add(in DOMString token) raises(DOMException); - void remove(in DOMString token) raises(DOMException); - boolean toggle(in DOMString token) raises(DOMException); +[ + GenerateIsReachable=ImplElementRoot, + IndexedGetter +] interface DOMTokenList { + readonly attribute unsigned long length; + [TreatReturnedNullStringAs=Null] DOMString item(in unsigned long index); + boolean contains(in DOMString token) raises(DOMException); + void add(in DOMString... tokens) raises(DOMException); + void remove(in DOMString... tokens) raises(DOMException); + boolean toggle(in DOMString token, in [Optional] boolean force) raises(DOMException); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [NotEnumerable] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif - }; +}; -} diff --git a/Source/WebCore/html/DOMURL.idl b/Source/WebCore/html/DOMURL.idl index b36e8f7ce..a90443f55 100644 --- a/Source/WebCore/html/DOMURL.idl +++ b/Source/WebCore/html/DOMURL.idl @@ -24,22 +24,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=BLOB, - Constructor, - JSGenerateToNativeObject, - JSGenerateToJSObject, - JSNoStaticTables, - InterfaceName=URL - ] DOMURL { +[ + Conditional=BLOB, + Constructor, + JSGenerateToNativeObject, + JSGenerateToJSObject, + JSNoStaticTables, + InterfaceName=URL +] interface DOMURL { #if defined(ENABLE_MEDIA_SOURCE) && ENABLE_MEDIA_SOURCE - [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in MediaSource? source); + [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in MediaSource? source); #endif #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM - [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in MediaStream? stream); + [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in MediaStream? stream); #endif - [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in Blob? blob); - [CallWith=ScriptExecutionContext] static void revokeObjectURL(in DOMString url); - }; -} + [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null] static DOMString createObjectURL(in Blob? blob); + [CallWith=ScriptExecutionContext] static void revokeObjectURL(in DOMString url); +}; diff --git a/Source/WebCore/html/DateInputType.cpp b/Source/WebCore/html/DateInputType.cpp index 4e973da69..1ff59329a 100644 --- a/Source/WebCore/html/DateInputType.cpp +++ b/Source/WebCore/html/DateInputType.cpp @@ -31,17 +31,18 @@ #include "config.h" #include "DateInputType.h" -#include "CalendarPickerElement.h" +#if ENABLE(INPUT_TYPE_DATE) #include "DateComponents.h" +#include "DateTimeFieldsState.h" #include "HTMLInputElement.h" #include "HTMLNames.h" #include "InputTypeNames.h" #include "KeyboardEvent.h" -#include "LocalizedDate.h" +#include "LocalizedStrings.h" +#include "Localizer.h" +#include "PickerIndicatorElement.h" #include <wtf/PassOwnPtr.h> -#if ENABLE(INPUT_TYPE_DATE) - namespace WebCore { using namespace HTMLNames; @@ -51,8 +52,8 @@ static const int dateDefaultStepBase = 0; static const int dateStepScaleFactor = 86400000; inline DateInputType::DateInputType(HTMLInputElement* element) - : BaseDateAndTimeInputType(element) -#if ENABLE(CALENDAR_PICKER) + : BaseDateInputType(element) +#if ENABLE(INPUT_TYPE_DATE_LEGACY_UI) , m_pickerElement(0) #endif { @@ -102,11 +103,11 @@ bool DateInputType::isDateField() const return true; } -#if ENABLE(CALENDAR_PICKER) +#if ENABLE(INPUT_TYPE_DATE_LEGACY_UI) void DateInputType::createShadowSubtree() { BaseDateAndTimeInputType::createShadowSubtree(); - RefPtr<CalendarPickerElement> pickerElement = CalendarPickerElement::create(element()->document()); + RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::create(element()->document()); m_pickerElement = pickerElement.get(); containerElement()->insertBefore(m_pickerElement, innerBlockElement()->nextSibling(), ASSERT_NO_EXCEPTION); } @@ -164,9 +165,30 @@ bool DateInputType::usesFixedPlaceholder() const String DateInputType::fixedPlaceholder() { - return localizedDateFormatText(); + return element()->localizer().dateFormatText(); } -#endif // ENABLE(CALENDAR_PICKER) +#endif // ENABLE(INPUT_TYPE_DATE_LEGACY_UI) + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) && !ENABLE(INPUT_TYPE_DATE_LEGACY_UI) +String DateInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +{ + if (!dateTimeFieldsState.hasDayOfMonth() || !dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear()) + return emptyString(); + + return String::format("%04u-%02u-%02u", dateTimeFieldsState.year(), dateTimeFieldsState.month(), dateTimeFieldsState.dayOfMonth()); +} + +void DateInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const +{ + layoutParameters.dateTimeFormat = layoutParameters.localizer.dateFormat(); + layoutParameters.fallbackDateTimeFormat = ASCIILiteral("yyyy-MM-dd"); + layoutParameters.minimumYear = fullYear(element()->fastGetAttribute(minAttr)); + layoutParameters.maximumYear = fullYear(element()->fastGetAttribute(maxAttr)); + layoutParameters.placeholderForDay = placeholderForDayOfMonthField(); + layoutParameters.placeholderForMonth = placeholderForMonthField(); + layoutParameters.placeholderForYear = placeholderForYearField(); +} +#endif } // namespace WebCore #endif diff --git a/Source/WebCore/html/DateInputType.h b/Source/WebCore/html/DateInputType.h index d48049daa..934ac2629 100644 --- a/Source/WebCore/html/DateInputType.h +++ b/Source/WebCore/html/DateInputType.h @@ -31,16 +31,21 @@ #ifndef DateInputType_h #define DateInputType_h -#include "BaseDateAndTimeInputType.h" -#include <wtf/RefPtr.h> - #if ENABLE(INPUT_TYPE_DATE) +#include "BaseMultipleFieldsDateAndTimeInputType.h" +#include <wtf/RefPtr.h> namespace WebCore { -class CalendarPickerElement; +class PickerIndicatorElement; + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) && !ENABLE(INPUT_TYPE_DATE_LEGACY_UI) +typedef BaseMultipleFieldsDateAndTimeInputType BaseDateInputType; +#else +typedef BaseDateAndTimeInputType BaseDateInputType; +#endif -class DateInputType : public BaseDateAndTimeInputType { +class DateInputType : public BaseDateInputType { public: static PassOwnPtr<InputType> create(HTMLInputElement*); @@ -52,7 +57,8 @@ private: virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; virtual bool isDateField() const OVERRIDE; -#if ENABLE(CALENDAR_PICKER) + +#if ENABLE(INPUT_TYPE_DATE_LEGACY_UI) virtual void createShadowSubtree() OVERRIDE; virtual void destroyShadowSubtree() OVERRIDE; virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE; @@ -65,10 +71,17 @@ private: virtual bool needsContainer() const OVERRIDE; virtual bool shouldHaveSpinButton() const OVERRIDE; - CalendarPickerElement* m_pickerElement; + PickerIndicatorElement* m_pickerElement; +#else +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) + // BaseMultipleFieldsDateAndTimeInputType functions + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE; +#endif #endif }; } // namespace WebCore + #endif #endif // DateInputType_h diff --git a/Source/WebCore/html/DateTimeFieldsState.cpp b/Source/WebCore/html/DateTimeFieldsState.cpp index 990389dc4..ae03a13da 100644 --- a/Source/WebCore/html/DateTimeFieldsState.cpp +++ b/Source/WebCore/html/DateTimeFieldsState.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldsState.h" #include "FormController.h" diff --git a/Source/WebCore/html/DateTimeFieldsState.h b/Source/WebCore/html/DateTimeFieldsState.h index 6fb444071..2dd219546 100644 --- a/Source/WebCore/html/DateTimeFieldsState.h +++ b/Source/WebCore/html/DateTimeFieldsState.h @@ -26,7 +26,7 @@ #ifndef DateTimeFieldsState_h #define DateTimeFieldsState_h -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include <wtf/text/WTFString.h> namespace WebCore { @@ -87,7 +87,7 @@ public: private: unsigned m_year; - unsigned m_month; + unsigned m_month; // 1 to 12. unsigned m_dayOfMonth; unsigned m_hour; // 1 to 12. unsigned m_minute; diff --git a/Source/WebCore/html/DateTimeInputType.cpp b/Source/WebCore/html/DateTimeInputType.cpp index 09b423172..1746a13cf 100644 --- a/Source/WebCore/html/DateTimeInputType.cpp +++ b/Source/WebCore/html/DateTimeInputType.cpp @@ -40,6 +40,14 @@ #if ENABLE(INPUT_TYPE_DATETIME) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +#include "DateTimeFieldsState.h" +#include "LocalizedStrings.h" +#include "Localizer.h" +#include <wtf/text/StringBuilder.h> +#include <wtf/text/WTFString.h> +#endif + namespace WebCore { using namespace HTMLNames; @@ -97,6 +105,61 @@ bool DateTimeInputType::isDateTimeField() const return true; } +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +// FIXME: It is better to share code for DateTimeInputType::formatDateTimeFieldsState() +// and DateTimeInputLocalType::formatDateTimeFieldsState(). +String DateTimeInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +{ + if (!dateTimeFieldsState.hasDayOfMonth() || !dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear() + || !dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM()) + return emptyString(); + + if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond()) { + return String::format("%04u-%02u-%02uT%02u:%02u:%02u.%03uZ", + dateTimeFieldsState.year(), + dateTimeFieldsState.month() + 1, + dateTimeFieldsState.dayOfMonth(), + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute(), + dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0, + dateTimeFieldsState.millisecond()); + } + + if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second()) { + return String::format("%04u-%02u-%02uT%02u:%02u:%02uZ", + dateTimeFieldsState.year(), + dateTimeFieldsState.month() + 1, + dateTimeFieldsState.dayOfMonth(), + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute(), + dateTimeFieldsState.second()); + } + + return String::format("%04u-%02u-%02uT%02u:%02uZ", + dateTimeFieldsState.year(), + dateTimeFieldsState.month() + 1, + dateTimeFieldsState.dayOfMonth(), + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute()); +} + +void DateTimeInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const +{ + if (shouldHaveSecondField(date)) { + layoutParameters.dateTimeFormat = layoutParameters.localizer.dateTimeFormatWithSeconds(); + layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm:ss"; + } else { + layoutParameters.dateTimeFormat = layoutParameters.localizer.dateTimeFormatWithoutSeconds(); + layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm"; + } + layoutParameters.minimumYear = fullYear(element()->fastGetAttribute(minAttr)); + layoutParameters.maximumYear = fullYear(element()->fastGetAttribute(maxAttr)); + layoutParameters.placeholderForDay = placeholderForDayOfMonthField(); + layoutParameters.placeholderForMonth = placeholderForMonthField(); + layoutParameters.placeholderForYear = placeholderForYearField(); +} +#endif + } // namespace WebCore #endif diff --git a/Source/WebCore/html/DateTimeInputType.h b/Source/WebCore/html/DateTimeInputType.h index d1f4a78aa..ee3842019 100644 --- a/Source/WebCore/html/DateTimeInputType.h +++ b/Source/WebCore/html/DateTimeInputType.h @@ -34,15 +34,22 @@ #include "BaseDateAndTimeInputType.h" #if ENABLE(INPUT_TYPE_DATETIME) +#include "BaseMultipleFieldsDateAndTimeInputType.h" namespace WebCore { -class DateTimeInputType : public BaseDateAndTimeInputType { +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +typedef BaseMultipleFieldsDateAndTimeInputType BaseDateTimeInputType; +#else +typedef BaseDateAndTimeInputType BaseDateTimeInputType; +#endif + +class DateTimeInputType : public BaseDateTimeInputType { public: static PassOwnPtr<InputType> create(HTMLInputElement*); private: - DateTimeInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { } + DateTimeInputType(HTMLInputElement* element) : BaseDateTimeInputType(element) { } virtual const AtomicString& formControlType() const OVERRIDE; virtual DateComponents::Type dateType() const OVERRIDE; virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE; @@ -50,6 +57,12 @@ private: virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; virtual bool isDateTimeField() const OVERRIDE; + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) + // BaseMultipleFieldsDateAndTimeInputType functions + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/html/DateTimeLocalInputType.cpp b/Source/WebCore/html/DateTimeLocalInputType.cpp index 9766b566c..b0cb95a8f 100644 --- a/Source/WebCore/html/DateTimeLocalInputType.cpp +++ b/Source/WebCore/html/DateTimeLocalInputType.cpp @@ -39,6 +39,14 @@ #if ENABLE(INPUT_TYPE_DATETIMELOCAL) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +#include "DateTimeFieldsState.h" +#include "LocalizedStrings.h" +#include "Localizer.h" +#include <wtf/text/StringBuilder.h> +#include <wtf/text/WTFString.h> +#endif + namespace WebCore { using namespace HTMLNames; @@ -103,6 +111,61 @@ bool DateTimeLocalInputType::isDateTimeLocalField() const return true; } +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +// FIXME: It is better to share code for DateTimeInputType::formatDateTimeFieldsState() +// and DateTimeInputLocalType::formatDateTimeFieldsState(). +String DateTimeLocalInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +{ + if (!dateTimeFieldsState.hasDayOfMonth() || !dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear() + || !dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM()) + return emptyString(); + + if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond()) { + return String::format("%04u-%02u-%02uT%02u:%02u:%02u.%03u", + dateTimeFieldsState.year(), + dateTimeFieldsState.month() + 1, + dateTimeFieldsState.dayOfMonth(), + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute(), + dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0, + dateTimeFieldsState.millisecond()); + } + + if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second()) { + return String::format("%04u-%02u-%02uT%02u:%02u:%02u", + dateTimeFieldsState.year(), + dateTimeFieldsState.month() + 1, + dateTimeFieldsState.dayOfMonth(), + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute(), + dateTimeFieldsState.second()); + } + + return String::format("%04u-%02u-%02uT%02u:%02u", + dateTimeFieldsState.year(), + dateTimeFieldsState.month() + 1, + dateTimeFieldsState.dayOfMonth(), + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute()); +} + +void DateTimeLocalInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const +{ + if (shouldHaveSecondField(date)) { + layoutParameters.dateTimeFormat = layoutParameters.localizer.dateTimeFormatWithSeconds(); + layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm:ss"; + } else { + layoutParameters.dateTimeFormat = layoutParameters.localizer.dateTimeFormatWithoutSeconds(); + layoutParameters.fallbackDateTimeFormat = "dd/MM/yyyy HH:mm"; + } + layoutParameters.minimumYear = fullYear(element()->fastGetAttribute(minAttr)); + layoutParameters.maximumYear = fullYear(element()->fastGetAttribute(maxAttr)); + layoutParameters.placeholderForDay = placeholderForDayOfMonthField(); + layoutParameters.placeholderForMonth = placeholderForMonthField(); + layoutParameters.placeholderForYear = placeholderForYearField(); +} +#endif + } // namespace WebCore #endif diff --git a/Source/WebCore/html/DateTimeLocalInputType.h b/Source/WebCore/html/DateTimeLocalInputType.h index ca40b3774..d8ec63823 100644 --- a/Source/WebCore/html/DateTimeLocalInputType.h +++ b/Source/WebCore/html/DateTimeLocalInputType.h @@ -31,18 +31,23 @@ #ifndef DateTimeLocalInputType_h #define DateTimeLocalInputType_h -#include "BaseDateAndTimeInputType.h" - #if ENABLE(INPUT_TYPE_DATETIMELOCAL) +#include "BaseMultipleFieldsDateAndTimeInputType.h" namespace WebCore { -class DateTimeLocalInputType : public BaseDateAndTimeInputType { +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +typedef BaseMultipleFieldsDateAndTimeInputType BaseDateTimeLocalInputType; +#else +typedef BaseDateAndTimeInputType BaseDateTimeLocalInputType; +#endif + +class DateTimeLocalInputType : public BaseDateTimeLocalInputType { public: static PassOwnPtr<InputType> create(HTMLInputElement*); private: - DateTimeLocalInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { } + DateTimeLocalInputType(HTMLInputElement* element) : BaseDateTimeLocalInputType(element) { } virtual const AtomicString& formControlType() const OVERRIDE; virtual DateComponents::Type dateType() const OVERRIDE; virtual double valueAsDate() const OVERRIDE; @@ -51,6 +56,12 @@ private: virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; virtual bool isDateTimeLocalField() const OVERRIDE; + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) + // BaseMultipleFieldsDateAndTimeInputType functions + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp index fbfe7b714..7f87b97ff 100644 --- a/Source/WebCore/html/FormController.cpp +++ b/Source/WebCore/html/FormController.cpp @@ -228,8 +228,8 @@ void SavedFormState::serializeTo(Vector<String>& stateVector) const { stateVector.append(String::number(m_controlStateCount)); for (FormElementStateMap::const_iterator it = m_stateForNewFormElements.begin(); it != m_stateForNewFormElements.end(); ++it) { - const FormElementKey& key = it->first; - const Deque<FormControlState>& queue = it->second; + const FormElementKey& key = it->key; + const Deque<FormControlState>& queue = it->value; for (Deque<FormControlState>::const_iterator queIterator = queue.begin(); queIterator != queue.end(); ++queIterator) { stateVector.append(key.name()); stateVector.append(key.type()); @@ -243,7 +243,7 @@ void SavedFormState::appendControlState(const AtomicString& name, const AtomicSt FormElementKey key(name.impl(), type.impl()); FormElementStateMap::iterator it = m_stateForNewFormElements.find(key); if (it != m_stateForNewFormElements.end()) - it->second.append(state); + it->value.append(state); else { Deque<FormControlState> stateList; stateList.append(state); @@ -259,10 +259,10 @@ FormControlState SavedFormState::takeControlState(const AtomicString& name, cons FormElementStateMap::iterator it = m_stateForNewFormElements.find(FormElementKey(name.impl(), type.impl())); if (it == m_stateForNewFormElements.end()) return FormControlState(); - ASSERT(it->second.size()); - FormControlState state = it->second.takeFirst(); + ASSERT(it->value.size()); + FormControlState state = it->value.takeFirst(); m_controlStateCount--; - if (!it->second.size()) + if (!it->value.size()) m_stateForNewFormElements.remove(it); return state; } @@ -271,10 +271,10 @@ Vector<String> SavedFormState::getReferencedFilePaths() const { Vector<String> toReturn; for (FormElementStateMap::const_iterator it = m_stateForNewFormElements.begin(); it != m_stateForNewFormElements.end(); ++it) { - const FormElementKey& key = it->first; + const FormElementKey& key = it->key; if (AtomicString(key.type()) != AtomicString("file")) continue; - const Deque<FormControlState>& queue = it->second; + const Deque<FormControlState>& queue = it->value; for (Deque<FormControlState>::const_iterator queIterator = queue.begin(); queIterator != queue.end(); ++queIterator) { const Vector<FileChooserFileInfo>& selectedFiles = HTMLInputElement::filesFromFileInputFormControlState(*queIterator); for (size_t i = 0; i < selectedFiles.size(); ++i) @@ -349,12 +349,12 @@ AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& co } FormToKeyMap::const_iterator it = m_formToKeyMap.find(form); if (it != m_formToKeyMap.end()) - return it->second; + return it->value; String signature = formSignature(*form); ASSERT(!signature.isNull()); FormSignatureToNextIndexMap::AddResult result = m_formSignatureToNextIndexMap.add(signature, 0); - unsigned nextIndex = result.iterator->second++; + unsigned nextIndex = result.iterator->value++; StringBuilder builder; builder.append(signature); @@ -405,8 +405,8 @@ PassOwnPtr<FormController::SavedFormStateMap> FormController::createSavedFormSta continue; SavedFormStateMap::AddResult result = stateMap->add(keyGenerator->formKey(*control).impl(), nullptr); if (result.isNewEntry) - result.iterator->second = SavedFormState::create(); - result.iterator->second->appendControlState(control->name(), control->type(), control->saveFormControlState()); + result.iterator->value = SavedFormState::create(); + result.iterator->value->appendControlState(control->name(), control->type(), control->saveFormControlState()); } return stateMap.release(); } @@ -418,8 +418,8 @@ Vector<String> FormController::formElementsState() const stateVector.reserveInitialCapacity(m_formElementsWithState.size() * 4); stateVector.append(formStateSignature()); for (SavedFormStateMap::const_iterator it = stateMap->begin(); it != stateMap->end(); ++it) { - stateVector.append(it->first.get()); - it->second->serializeTo(stateVector); + stateVector.append(it->key.get()); + it->value->serializeTo(stateVector); } bool hasOnlySignature = stateVector.size() == 1; if (hasOnlySignature) @@ -441,8 +441,8 @@ FormControlState FormController::takeStateForFormElement(const HTMLFormControlEl SavedFormStateMap::iterator it = m_savedFormStateMap.find(m_formKeyGenerator->formKey(control).impl()); if (it == m_savedFormStateMap.end()) return FormControlState(); - FormControlState state = it->second->takeControlState(control.name(), control.type()); - if (it->second->isEmpty()) + FormControlState state = it->value->takeControlState(control.name(), control.type()); + if (it->value->isEmpty()) m_savedFormStateMap.remove(it); return state; } @@ -511,7 +511,7 @@ Vector<String> FormController::getReferencedFilePaths(const Vector<String>& stat SavedFormStateMap map; formStatesFromStateVector(stateVector, map); for (SavedFormStateMap::const_iterator it = map.begin(); it != map.end(); ++it) - toReturn.append(it->second->getReferencedFilePaths()); + toReturn.append(it->value->getReferencedFilePaths()); return toReturn; } diff --git a/Source/WebCore/html/HTMLAllCollection.idl b/Source/WebCore/html/HTMLAllCollection.idl index f9c093da0..c9bc92cef 100644 --- a/Source/WebCore/html/HTMLAllCollection.idl +++ b/Source/WebCore/html/HTMLAllCollection.idl @@ -23,21 +23,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + IndexedGetter, + NamedGetter, + CustomCall, + MasqueradesAsUndefined, + GenerateIsReachable=ImplBaseRoot, + V8DependentLifetime +] interface HTMLAllCollection { + readonly attribute unsigned long length; + [Custom] Node item(in [Optional=DefaultIsUndefined] unsigned long index); + [Custom] Node namedItem(in DOMString name); + // FIXME: This should return an HTMLAllCollection. + NodeList tags(in DOMString name); +}; - interface [ - IndexedGetter, - NamedGetter, - CustomCall, - MasqueradesAsUndefined, - GenerateIsReachable=ImplBaseRoot, - V8DependentLifetime - ] HTMLAllCollection { - readonly attribute unsigned long length; - [Custom] Node item(in [Optional=DefaultIsUndefined] unsigned long index); - [Custom] Node namedItem(in DOMString name); - // FIXME: This should return an HTMLAllCollection. - NodeList tags(in DOMString name); - }; - -} diff --git a/Source/WebCore/html/HTMLAnchorElement.idl b/Source/WebCore/html/HTMLAnchorElement.idl index 7bd174c63..df6836282 100644 --- a/Source/WebCore/html/HTMLAnchorElement.idl +++ b/Source/WebCore/html/HTMLAnchorElement.idl @@ -18,56 +18,53 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLAnchorElement : HTMLElement { - attribute [Reflect] DOMString charset; - attribute [Reflect] DOMString coords; - attribute [Conditional=DOWNLOAD_ATTRIBUTE, Reflect] DOMString download; - attribute [Reflect, URL] DOMString href; - attribute [Reflect] DOMString hreflang; - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString ping; - attribute [Reflect] DOMString rel; - attribute [Reflect] DOMString rev; - attribute [Reflect] DOMString shape; - attribute [Reflect] DOMString target; - attribute [Reflect] DOMString type; +interface HTMLAnchorElement : HTMLElement { + [Reflect] attribute DOMString charset; + [Reflect] attribute DOMString coords; + [Conditional=DOWNLOAD_ATTRIBUTE, Reflect] attribute DOMString download; + [Reflect, URL] attribute DOMString href; + [Reflect] attribute DOMString hreflang; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString ping; + [Reflect] attribute DOMString rel; + [Reflect] attribute DOMString rev; + [Reflect] attribute DOMString shape; + [Reflect] attribute DOMString target; + [Reflect] attribute DOMString type; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - readonly attribute DOMString hash; - readonly attribute DOMString host; - readonly attribute DOMString hostname; - readonly attribute DOMString pathname; - readonly attribute DOMString port; - readonly attribute DOMString protocol; - readonly attribute DOMString search; + readonly attribute DOMString hash; + readonly attribute DOMString host; + readonly attribute DOMString hostname; + readonly attribute DOMString pathname; + readonly attribute DOMString port; + readonly attribute DOMString protocol; + readonly attribute DOMString search; #else - attribute [TreatNullAs=NullString] DOMString hash; - attribute [TreatNullAs=NullString] DOMString host; - attribute [TreatNullAs=NullString] DOMString hostname; - attribute [TreatNullAs=NullString] DOMString pathname; - attribute [TreatNullAs=NullString] DOMString port; - attribute [TreatNullAs=NullString] DOMString protocol; - attribute [TreatNullAs=NullString] DOMString search; + [TreatNullAs=NullString] attribute DOMString hash; + [TreatNullAs=NullString] attribute DOMString host; + [TreatNullAs=NullString] attribute DOMString hostname; + [TreatNullAs=NullString] attribute DOMString pathname; + [TreatNullAs=NullString] attribute DOMString port; + [TreatNullAs=NullString] attribute DOMString protocol; + [TreatNullAs=NullString] attribute DOMString search; - readonly attribute [TreatNullAs=NullString] DOMString origin; + [TreatNullAs=NullString] readonly attribute DOMString origin; #endif - readonly attribute DOMString text; + readonly attribute DOMString text; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [NotEnumerable] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // Objective-C extension: - readonly attribute URL absoluteLinkURL; + // Objective-C extension: + readonly attribute URL absoluteLinkURL; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLAppletElement.idl b/Source/WebCore/html/HTMLAppletElement.idl index 8f16a400f..f80b11a5a 100644 --- a/Source/WebCore/html/HTMLAppletElement.idl +++ b/Source/WebCore/html/HTMLAppletElement.idl @@ -18,32 +18,29 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface [ - CustomNamedSetter, - JSCustomGetOwnPropertySlotAndDescriptor, - CustomCall - ] HTMLAppletElement : HTMLElement { - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString alt; - attribute [Reflect] DOMString archive; - attribute [Reflect] DOMString code; - attribute [Reflect] DOMString codeBase; - attribute [Reflect] DOMString height; +[ + CustomNamedSetter, + JSCustomGetOwnPropertySlotAndDescriptor, + CustomCall +] interface HTMLAppletElement : HTMLElement { + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString alt; + [Reflect] attribute DOMString archive; + [Reflect] attribute DOMString code; + [Reflect] attribute DOMString codeBase; + [Reflect] attribute DOMString height; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [Reflect] DOMString hspace; + [Reflect] attribute DOMString hspace; #else - attribute [Reflect] long hspace; + [Reflect] attribute long hspace; #endif - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString object; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString object; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [Reflect] DOMString vspace; + [Reflect] attribute DOMString vspace; #else - attribute [Reflect] long vspace; + [Reflect] attribute long vspace; #endif - attribute [Reflect] DOMString width; - }; + [Reflect] attribute DOMString width; +}; -} diff --git a/Source/WebCore/html/HTMLAreaElement.idl b/Source/WebCore/html/HTMLAreaElement.idl index dfb9c9b5d..d0250529b 100644 --- a/Source/WebCore/html/HTMLAreaElement.idl +++ b/Source/WebCore/html/HTMLAreaElement.idl @@ -18,33 +18,30 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLAreaElement : HTMLElement { - attribute [Reflect] DOMString alt; - attribute [Reflect] DOMString coords; - attribute [Reflect, URL] DOMString href; - attribute [Reflect] boolean noHref; - attribute [Reflect] DOMString ping; - attribute [Reflect] DOMString shape; - attribute [Reflect] DOMString target; +interface HTMLAreaElement : HTMLElement { + [Reflect] attribute DOMString alt; + [Reflect] attribute DOMString coords; + [Reflect, URL] attribute DOMString href; + [Reflect] attribute boolean noHref; + [Reflect] attribute DOMString ping; + [Reflect] attribute DOMString shape; + [Reflect] attribute DOMString target; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif - // IE Extensions - readonly attribute DOMString hash; - readonly attribute DOMString host; - readonly attribute DOMString hostname; - readonly attribute DOMString pathname; - readonly attribute DOMString port; - readonly attribute DOMString protocol; - readonly attribute DOMString search; + // IE Extensions + readonly attribute DOMString hash; + readonly attribute DOMString host; + readonly attribute DOMString hostname; + readonly attribute DOMString pathname; + readonly attribute DOMString port; + readonly attribute DOMString protocol; + readonly attribute DOMString search; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // Objective-C extension: - readonly attribute URL absoluteLinkURL; + // Objective-C extension: + readonly attribute URL absoluteLinkURL; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLAudioElement.idl b/Source/WebCore/html/HTMLAudioElement.idl index 1adf01c46..9b3f8c6af 100644 --- a/Source/WebCore/html/HTMLAudioElement.idl +++ b/Source/WebCore/html/HTMLAudioElement.idl @@ -23,11 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ActiveDOMObject, - Conditional=VIDEO, - NamedConstructor=Audio(in [Optional=DefaultIsNullString] DOMString src) - ] HTMLAudioElement : HTMLMediaElement { - }; -} +[ + ActiveDOMObject, + Conditional=VIDEO, + NamedConstructor=Audio(in [Optional=DefaultIsNullString] DOMString src) +] interface HTMLAudioElement : HTMLMediaElement { +}; diff --git a/Source/WebCore/html/HTMLBRElement.idl b/Source/WebCore/html/HTMLBRElement.idl index a6d215d53..c909dc1c8 100644 --- a/Source/WebCore/html/HTMLBRElement.idl +++ b/Source/WebCore/html/HTMLBRElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLBRElement : HTMLElement { + [Reflect] attribute DOMString clear; +}; - interface HTMLBRElement : HTMLElement { - attribute [Reflect] DOMString clear; - }; - -} diff --git a/Source/WebCore/html/HTMLBaseElement.idl b/Source/WebCore/html/HTMLBaseElement.idl index 2750c9ee8..0f63ddd19 100644 --- a/Source/WebCore/html/HTMLBaseElement.idl +++ b/Source/WebCore/html/HTMLBaseElement.idl @@ -17,11 +17,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLBaseElement : HTMLElement { + [Reflect, URL] attribute DOMString href; + [Reflect] attribute DOMString target; +}; - interface HTMLBaseElement : HTMLElement { - attribute [Reflect, URL] DOMString href; - attribute [Reflect] DOMString target; - }; - -} diff --git a/Source/WebCore/html/HTMLBaseFontElement.idl b/Source/WebCore/html/HTMLBaseFontElement.idl index 95bc92c37..99bb33096 100644 --- a/Source/WebCore/html/HTMLBaseFontElement.idl +++ b/Source/WebCore/html/HTMLBaseFontElement.idl @@ -17,15 +17,12 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLBaseFontElement : HTMLElement { - attribute [Reflect] DOMString color; - attribute [Reflect] DOMString face; +interface HTMLBaseFontElement : HTMLElement { + [Reflect] attribute DOMString color; + [Reflect] attribute DOMString face; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString size; // this changed to a long, but our existing API is a string + [Reflect] attribute DOMString size; // this changed to a long, but our existing API is a string #else - attribute [Reflect] long size; + [Reflect] attribute long size; #endif - }; -} +}; diff --git a/Source/WebCore/html/HTMLBodyElement.idl b/Source/WebCore/html/HTMLBodyElement.idl index a6b7f567d..32a7d5095 100644 --- a/Source/WebCore/html/HTMLBodyElement.idl +++ b/Source/WebCore/html/HTMLBodyElement.idl @@ -18,42 +18,39 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLBodyElement : HTMLElement { - attribute [Reflect] DOMString aLink; - attribute [Reflect] DOMString background; - attribute [Reflect] DOMString bgColor; - attribute [Reflect] DOMString link; - attribute [Reflect] DOMString text; - attribute [Reflect] DOMString vLink; +interface HTMLBodyElement : HTMLElement { + [Reflect] attribute DOMString aLink; + [Reflect] attribute DOMString background; + [Reflect] attribute DOMString bgColor; + [Reflect] attribute DOMString link; + [Reflect] attribute DOMString text; + [Reflect] attribute DOMString vLink; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C - // Event handler attributes - attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeunload; - attribute [NotEnumerable, JSWindowEventListener] EventListener onhashchange; - attribute [NotEnumerable, JSWindowEventListener] EventListener onmessage; - attribute [NotEnumerable, JSWindowEventListener] EventListener onoffline; - attribute [NotEnumerable, JSWindowEventListener] EventListener ononline; - attribute [NotEnumerable, JSWindowEventListener] EventListener onpopstate; - attribute [NotEnumerable, JSWindowEventListener] EventListener onresize; - attribute [NotEnumerable, JSWindowEventListener] EventListener onstorage; - attribute [NotEnumerable, JSWindowEventListener] EventListener onunload; + // Event handler attributes + [NotEnumerable, JSWindowEventListener] attribute EventListener onbeforeunload; + [NotEnumerable, JSWindowEventListener] attribute EventListener onhashchange; + [NotEnumerable, JSWindowEventListener] attribute EventListener onmessage; + [NotEnumerable, JSWindowEventListener] attribute EventListener onoffline; + [NotEnumerable, JSWindowEventListener] attribute EventListener ononline; + [NotEnumerable, JSWindowEventListener] attribute EventListener onpopstate; + [NotEnumerable, JSWindowEventListener] attribute EventListener onresize; + [NotEnumerable, JSWindowEventListener] attribute EventListener onstorage; + [NotEnumerable, JSWindowEventListener] attribute EventListener onunload; - attribute [Conditional=ORIENTATION_EVENTS, NotEnumerable, JSWindowEventListener] EventListener onorientationchange; + [Conditional=ORIENTATION_EVENTS, NotEnumerable, JSWindowEventListener] attribute EventListener onorientationchange; - // Overrides of Element attributes (with different implementation in bindings). - attribute [NotEnumerable, JSWindowEventListener] EventListener onblur; - attribute [NotEnumerable, JSWindowEventListener] EventListener onerror; - attribute [NotEnumerable, JSWindowEventListener] EventListener onfocus; - attribute [NotEnumerable, JSWindowEventListener] EventListener onload; + // Overrides of Element attributes (with different implementation in bindings). + [NotEnumerable, JSWindowEventListener] attribute EventListener onblur; + [NotEnumerable, JSWindowEventListener] attribute EventListener onerror; + [NotEnumerable, JSWindowEventListener] attribute EventListener onfocus; + [NotEnumerable, JSWindowEventListener] attribute EventListener onload; - // Not implemented yet. - // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; - // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; - // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; - // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; + // Not implemented yet. + // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLButtonElement.idl b/Source/WebCore/html/HTMLButtonElement.idl index 02e91abef..252a422f2 100644 --- a/Source/WebCore/html/HTMLButtonElement.idl +++ b/Source/WebCore/html/HTMLButtonElement.idl @@ -18,35 +18,32 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLButtonElement : HTMLElement { + [Reflect] attribute boolean autofocus; + [Reflect] attribute boolean disabled; + readonly attribute HTMLFormElement form; + [Reflect, URL] attribute DOMString formAction; + [TreatNullAs=NullString] attribute DOMString formEnctype; + [TreatNullAs=NullString] attribute DOMString formMethod; + [Reflect] attribute boolean formNoValidate; + [Reflect] attribute DOMString formTarget; + [Reflect] attribute DOMString name; + [TreatNullAs=NullString] attribute DOMString type; + [Reflect] attribute DOMString value; - interface HTMLButtonElement : HTMLElement { - attribute [Reflect] boolean autofocus; - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute [Reflect, URL] DOMString formAction; - attribute [TreatNullAs=NullString] DOMString formEnctype; - attribute [TreatNullAs=NullString] DOMString formMethod; - attribute [Reflect] boolean formNoValidate; - attribute [Reflect] DOMString formTarget; - attribute [Reflect] DOMString name; - attribute [TreatNullAs=NullString] DOMString type; - attribute [Reflect] DOMString value; + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - - readonly attribute NodeList labels; + readonly attribute NodeList labels; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - void click(); + void click(); #endif - }; -} +}; diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index e1b9f48a1..ffc6182f5 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -46,6 +46,7 @@ #include "Page.h" #include "RenderHTMLCanvas.h" #include "Settings.h" +#include "WebCoreMemoryInstrumentation.h" #include <math.h> #include <stdio.h> @@ -632,4 +633,16 @@ AffineTransform HTMLCanvasElement::baseTransform() const return m_imageBuffer->baseTransform() * transform; } +void HTMLCanvasElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const +{ + MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); + HTMLElement::reportMemoryUsage(memoryObjectInfo); + info.addMember(m_observers); + info.addMember(m_context); + info.addMember(m_imageBuffer); + info.addMember(m_contextStateSaver); + info.addMember(m_presentedImage); + info.addMember(m_copiedImage); +} + } diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h index e80d85979..6343b50ac 100644 --- a/Source/WebCore/html/HTMLCanvasElement.h +++ b/Source/WebCore/html/HTMLCanvasElement.h @@ -31,6 +31,7 @@ #include "FloatRect.h" #include "HTMLElement.h" #include "IntSize.h" +#include <wtf/Forward.h> #if PLATFORM(CHROMIUM) || PLATFORM(QT) #define DefaultInterpolationQuality InterpolationMedium @@ -137,6 +138,8 @@ public: float deviceScaleFactor() const { return m_deviceScaleFactor; } + virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; + private: HTMLCanvasElement(const QualifiedName&, Document*); diff --git a/Source/WebCore/html/HTMLCanvasElement.idl b/Source/WebCore/html/HTMLCanvasElement.idl index 2be96a556..9e85dca36 100644 --- a/Source/WebCore/html/HTMLCanvasElement.idl +++ b/Source/WebCore/html/HTMLCanvasElement.idl @@ -24,25 +24,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + JSGenerateToNativeObject +] interface HTMLCanvasElement : HTMLElement { - interface [ - JSGenerateToNativeObject - ] HTMLCanvasElement : HTMLElement { + attribute long width; + attribute long height; - attribute long width; - attribute long height; - - [Custom] DOMString toDataURL(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString type) - raises(DOMException); + [Custom] DOMString toDataURL(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString type) + raises(DOMException); #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C - // The custom binding is needed to handle context creation attributes. - [Custom] DOMObject getContext(in [Optional=DefaultIsUndefined] DOMString contextId); + // The custom binding is needed to handle context creation attributes. + [Custom] DOMObject getContext(in [Optional=DefaultIsUndefined] DOMString contextId); #endif #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index 91e18a3fb..1ecb644ca 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -559,7 +559,7 @@ PassRefPtr<NodeList> HTMLCollection::tags(const String& name) void HTMLCollectionCacheBase::append(NodeCacheMap& map, const AtomicString& key, Element* element) { - OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).iterator->second; + OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).iterator->value; if (!vector) vector = adoptPtr(new Vector<Element*>); vector->append(element); diff --git a/Source/WebCore/html/HTMLCollection.idl b/Source/WebCore/html/HTMLCollection.idl index efd91c72c..8650428d0 100644 --- a/Source/WebCore/html/HTMLCollection.idl +++ b/Source/WebCore/html/HTMLCollection.idl @@ -18,23 +18,20 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface [ - IndexedGetter, - NamedGetter, - CustomToJSObject, - GenerateIsReachable=ImplBaseRoot, - V8DependentLifetime, - ObjCPolymorphic - ] HTMLCollection { - readonly attribute unsigned long length; - Node item(in [Optional=DefaultIsUndefined] unsigned long index); - [Custom] Node namedItem(in [Optional=DefaultIsUndefined] DOMString name); +[ + IndexedGetter, + NamedGetter, + CustomToJSObject, + GenerateIsReachable=ImplBaseRoot, + V8DependentLifetime, + ObjCPolymorphic +] interface HTMLCollection { + readonly attribute unsigned long length; + Node item(in [Optional=DefaultIsUndefined] unsigned long index); + [Custom] Node namedItem(in [Optional=DefaultIsUndefined] DOMString name); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - NodeList tags(in [Optional=DefaultIsUndefined] DOMString name); + NodeList tags(in [Optional=DefaultIsUndefined] DOMString name); #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLDListElement.idl b/Source/WebCore/html/HTMLDListElement.idl index 1a9326fbf..95a97ffac 100644 --- a/Source/WebCore/html/HTMLDListElement.idl +++ b/Source/WebCore/html/HTMLDListElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLDListElement : HTMLElement { + [Reflect] attribute boolean compact; +}; - interface HTMLDListElement : HTMLElement { - attribute [Reflect] boolean compact; - }; - -} diff --git a/Source/WebCore/html/HTMLDataListElement.idl b/Source/WebCore/html/HTMLDataListElement.idl index 7e0d69c96..13fdaa404 100644 --- a/Source/WebCore/html/HTMLDataListElement.idl +++ b/Source/WebCore/html/HTMLDataListElement.idl @@ -28,10 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=DATALIST_ELEMENT, - ] HTMLDataListElement : HTMLElement { - readonly attribute HTMLCollection options; - }; -} +[ + Conditional=DATALIST_ELEMENT, +] interface HTMLDataListElement : HTMLElement { + readonly attribute HTMLCollection options; +}; diff --git a/Source/WebCore/html/HTMLDetailsElement.idl b/Source/WebCore/html/HTMLDetailsElement.idl index 087f083ff..ca3894e2f 100644 --- a/Source/WebCore/html/HTMLDetailsElement.idl +++ b/Source/WebCore/html/HTMLDetailsElement.idl @@ -17,11 +17,9 @@ * Boston, MA 02110-1301, USA. */ -module html { - interface [ - Conditional=DETAILS_ELEMENT - ] HTMLDetailsElement : HTMLElement { - attribute [Reflect] boolean open; - }; +[ + Conditional=DETAILS_ELEMENT +] interface HTMLDetailsElement : HTMLElement { + [Reflect] attribute boolean open; +}; -} diff --git a/Source/WebCore/html/HTMLDialogElement.idl b/Source/WebCore/html/HTMLDialogElement.idl index 3c70c0c53..a6df0c718 100644 --- a/Source/WebCore/html/HTMLDialogElement.idl +++ b/Source/WebCore/html/HTMLDialogElement.idl @@ -23,15 +23,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=DIALOG_ELEMENT +] interface HTMLDialogElement : HTMLElement { + [Reflect] attribute boolean open; + void close() raises(DOMException); + void show(); + void showModal() raises(DOMException); +}; - interface [ - Conditional=DIALOG_ELEMENT - ] HTMLDialogElement : HTMLElement { - attribute [Reflect] boolean open; - void close() raises(DOMException); - void show(); - void showModal() raises(DOMException); - }; - -} diff --git a/Source/WebCore/html/HTMLDirectoryElement.idl b/Source/WebCore/html/HTMLDirectoryElement.idl index b0969746a..541ae007f 100644 --- a/Source/WebCore/html/HTMLDirectoryElement.idl +++ b/Source/WebCore/html/HTMLDirectoryElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLDirectoryElement : HTMLElement { + [Reflect] attribute boolean compact; +}; - interface HTMLDirectoryElement : HTMLElement { - attribute [Reflect] boolean compact; - }; - -} diff --git a/Source/WebCore/html/HTMLDivElement.idl b/Source/WebCore/html/HTMLDivElement.idl index 90fb84f8f..40c8db444 100644 --- a/Source/WebCore/html/HTMLDivElement.idl +++ b/Source/WebCore/html/HTMLDivElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLDivElement : HTMLElement { + [Reflect] attribute DOMString align; +}; - interface HTMLDivElement : HTMLElement { - attribute [Reflect] DOMString align; - }; - -} diff --git a/Source/WebCore/html/HTMLDocument.idl b/Source/WebCore/html/HTMLDocument.idl index de9b51d84..717301c20 100644 --- a/Source/WebCore/html/HTMLDocument.idl +++ b/Source/WebCore/html/HTMLDocument.idl @@ -18,48 +18,45 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + CustomNamedGetter, + V8CustomToJSObject +] interface HTMLDocument : Document { + [JSCustom, V8Custom] void open(); + void close(); + [Custom] void write(in [Optional=DefaultIsUndefined] DOMString text); + [Custom] void writeln(in [Optional=DefaultIsUndefined] DOMString text); - interface [ - CustomNamedGetter, - V8CustomToJSObject - ] HTMLDocument : Document { - [JSCustom, V8Custom] void open(); - void close(); - [Custom] void write(in [Optional=DefaultIsUndefined] DOMString text); - [Custom] void writeln(in [Optional=DefaultIsUndefined] DOMString text); + readonly attribute HTMLCollection embeds; + readonly attribute HTMLCollection plugins; + readonly attribute HTMLCollection scripts; - readonly attribute HTMLCollection embeds; - readonly attribute HTMLCollection plugins; - readonly attribute HTMLCollection scripts; - - // Extensions + // Extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - // FIXME: This should eventually be available (if they are wanted) for all languages. - attribute [Custom, Deletable] HTMLAllCollection all; + // FIXME: This should eventually be available (if they are wanted) for all languages. + [Custom, Deletable] attribute HTMLAllCollection all; #endif - void clear(); + void clear(); - void captureEvents(); - void releaseEvents(); + void captureEvents(); + void releaseEvents(); - readonly attribute long width; - readonly attribute long height; - attribute [TreatNullAs=NullString] DOMString dir; - attribute [TreatNullAs=NullString] DOMString designMode; - readonly attribute DOMString compatMode; + readonly attribute long width; + readonly attribute long height; + [TreatNullAs=NullString] attribute DOMString dir; + [TreatNullAs=NullString] attribute DOMString designMode; + readonly attribute DOMString compatMode; - readonly attribute Element activeElement; - boolean hasFocus(); + readonly attribute Element activeElement; + boolean hasFocus(); - // Deprecated attributes - attribute [TreatNullAs=NullString] DOMString bgColor; - attribute [TreatNullAs=NullString] DOMString fgColor; - attribute [TreatNullAs=NullString] DOMString alinkColor; - attribute [TreatNullAs=NullString] DOMString linkColor; - attribute [TreatNullAs=NullString] DOMString vlinkColor; - }; + // Deprecated attributes + [TreatNullAs=NullString] attribute DOMString bgColor; + [TreatNullAs=NullString] attribute DOMString fgColor; + [TreatNullAs=NullString] attribute DOMString alinkColor; + [TreatNullAs=NullString] attribute DOMString linkColor; + [TreatNullAs=NullString] attribute DOMString vlinkColor; +}; -} diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl index 9501d3a6a..d3206f2d1 100644 --- a/Source/WebCore/html/HTMLElement.idl +++ b/Source/WebCore/html/HTMLElement.idl @@ -18,80 +18,77 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + JSGenerateToNativeObject, + JSCustomPushEventHandlerScope, + V8CustomToJSObject +] interface HTMLElement : Element { + // iht.com relies on id returning the empty string when no id is present. + // Other browsers do this as well. So we don't convert null to JS null. + [Reflect] attribute DOMString id; + [Reflect] attribute DOMString title; + [Reflect] attribute DOMString lang; + attribute boolean translate; + [Reflect] attribute DOMString dir; - interface [ - JSGenerateToNativeObject, - JSCustomPushEventHandlerScope, - V8CustomToJSObject - ] HTMLElement : Element { - // iht.com relies on id returning the empty string when no id is present. - // Other browsers do this as well. So we don't convert null to JS null. - attribute [Reflect] DOMString id; - attribute [Reflect] DOMString title; - attribute [Reflect] DOMString lang; - attribute boolean translate; - attribute [Reflect] DOMString dir; + attribute long tabIndex; + attribute boolean draggable; + [Reflect] attribute DOMString webkitdropzone; + [Reflect] attribute boolean hidden; + [Reflect] attribute DOMString accessKey; - attribute long tabIndex; - attribute boolean draggable; - attribute [Reflect] DOMString webkitdropzone; - attribute [Reflect] boolean hidden; - attribute [Reflect] DOMString accessKey; + // Extensions + [TreatNullAs=NullString] attribute DOMString innerHTML + setter raises(DOMException); + [TreatNullAs=NullString] attribute DOMString innerText + setter raises(DOMException); + [TreatNullAs=NullString] attribute DOMString outerHTML + setter raises(DOMException); + [TreatNullAs=NullString] attribute DOMString outerText + setter raises(DOMException); - // Extensions - attribute [TreatNullAs=NullString] DOMString innerHTML - setter raises(DOMException); - attribute [TreatNullAs=NullString] DOMString innerText - setter raises(DOMException); - attribute [TreatNullAs=NullString] DOMString outerHTML - setter raises(DOMException); - attribute [TreatNullAs=NullString] DOMString outerText - setter raises(DOMException); + Element insertAdjacentElement(in [Optional=DefaultIsUndefined] DOMString where, + in [Optional=DefaultIsUndefined] Element element) + raises(DOMException); + void insertAdjacentHTML(in [Optional=DefaultIsUndefined] DOMString where, + in [Optional=DefaultIsUndefined] DOMString html) + raises(DOMException); + void insertAdjacentText(in [Optional=DefaultIsUndefined] DOMString where, + in [Optional=DefaultIsUndefined] DOMString text) + raises(DOMException); - Element insertAdjacentElement(in [Optional=DefaultIsUndefined] DOMString where, - in [Optional=DefaultIsUndefined] Element element) - raises(DOMException); - void insertAdjacentHTML(in [Optional=DefaultIsUndefined] DOMString where, - in [Optional=DefaultIsUndefined] DOMString html) - raises(DOMException); - void insertAdjacentText(in [Optional=DefaultIsUndefined] DOMString where, - in [Optional=DefaultIsUndefined] DOMString text) - raises(DOMException); + readonly attribute HTMLCollection children; - readonly attribute HTMLCollection children; + [TreatNullAs=NullString] attribute DOMString contentEditable + setter raises(DOMException); + readonly attribute boolean isContentEditable; - attribute [TreatNullAs=NullString] DOMString contentEditable - setter raises(DOMException); - readonly attribute boolean isContentEditable; - - attribute boolean spellcheck; + attribute boolean spellcheck; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // No Objective-C bindings yet. - attribute [Conditional=MICRODATA, Reflect] boolean itemScope; - readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemType; - attribute [Conditional=MICRODATA, Reflect, URL] DOMString itemId; + [Conditional=MICRODATA, Reflect] attribute boolean itemScope; + [Conditional=MICRODATA] readonly attribute DOMSettableTokenList itemType; + [Conditional=MICRODATA, Reflect, URL] attribute DOMString itemId; - readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemRef; - readonly attribute [Conditional=MICRODATA] DOMSettableTokenList itemProp; + [Conditional=MICRODATA] readonly attribute DOMSettableTokenList itemRef; + [Conditional=MICRODATA] readonly attribute DOMSettableTokenList itemProp; #if defined(ENABLE_MICRODATA) && ENABLE_MICRODATA - readonly attribute [Conditional=MICRODATA] HTMLPropertiesCollection properties; + [Conditional=MICRODATA] readonly attribute HTMLPropertiesCollection properties; #endif #endif #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C - attribute [Conditional=MICRODATA, Custom] DOMObject itemValue - setter raises(DOMException); + [Conditional=MICRODATA, Custom] attribute DOMObject itemValue + setter raises(DOMException); #endif #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - readonly attribute DOMString titleDisplayString; + readonly attribute DOMString titleDisplayString; #endif - void click(); - }; + void click(); +}; -} diff --git a/Source/WebCore/html/HTMLEmbedElement.idl b/Source/WebCore/html/HTMLEmbedElement.idl index b6e3c166a..3716567ed 100644 --- a/Source/WebCore/html/HTMLEmbedElement.idl +++ b/Source/WebCore/html/HTMLEmbedElement.idl @@ -18,33 +18,30 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface [ - CustomNamedSetter, - JSCustomGetOwnPropertySlotAndDescriptor, - CustomCall - ] HTMLEmbedElement : HTMLElement { - attribute [Reflect] DOMString align; +[ + CustomNamedSetter, + JSCustomGetOwnPropertySlotAndDescriptor, + CustomCall +] interface HTMLEmbedElement : HTMLElement { +attribute [Reflect] DOMString align; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [Reflect] DOMString height; +attribute [Reflect] DOMString height; #else - attribute [Reflect] long height; +attribute [Reflect] long height; #endif - attribute [Reflect] DOMString name; - attribute [Reflect, URL] DOMString src; - attribute [Reflect] DOMString type; +attribute [Reflect] DOMString name; +attribute [Reflect, URL] DOMString src; +attribute [Reflect] DOMString type; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [Reflect] DOMString width; +attribute [Reflect] DOMString width; #else - attribute [Reflect] long width; +attribute [Reflect] long width; #endif #if defined(ENABLE_SVG) && ENABLE_SVG #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C || defined(ENABLE_SVG_DOM_OBJC_BINDINGS) && ENABLE_SVG_DOM_OBJC_BINDINGS - [CheckSecurityForNode] SVGDocument getSVGDocument() raises(DOMException); +[CheckSecurityForNode] SVGDocument getSVGDocument() raises(DOMException); #endif #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLFieldSetElement.idl b/Source/WebCore/html/HTMLFieldSetElement.idl index d67b3f647..5f3b4f385 100644 --- a/Source/WebCore/html/HTMLFieldSetElement.idl +++ b/Source/WebCore/html/HTMLFieldSetElement.idl @@ -17,21 +17,18 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLFieldSetElement : HTMLElement { + [Reflect] attribute boolean disabled; + readonly attribute HTMLFormElement form; + [Reflect] attribute DOMString name; - interface HTMLFieldSetElement : HTMLElement { - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute [Reflect] DOMString name; + readonly attribute DOMString type; - readonly attribute DOMString type; + readonly attribute HTMLCollection elements; - readonly attribute HTMLCollection elements; - - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - }; -} + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); +}; diff --git a/Source/WebCore/html/HTMLFontElement.idl b/Source/WebCore/html/HTMLFontElement.idl index 141816d1d..d2da3a9eb 100644 --- a/Source/WebCore/html/HTMLFontElement.idl +++ b/Source/WebCore/html/HTMLFontElement.idl @@ -17,12 +17,9 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLFontElement : HTMLElement { + [Reflect] attribute DOMString color; + [Reflect] attribute DOMString face; + [Reflect] attribute DOMString size; +}; - interface HTMLFontElement : HTMLElement { - attribute [Reflect] DOMString color; - attribute [Reflect] DOMString face; - attribute [Reflect] DOMString size; - }; - -} diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index db368c485..437be051a 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -297,7 +297,6 @@ static void updateFromElementCallback(Node* node, unsigned) { ASSERT_ARG(node, node->isElementNode()); ASSERT_ARG(node, static_cast<Element*>(node)->isFormControlElement()); - ASSERT(node->renderer()); if (RenderObject* renderer = node->renderer()) renderer->updateFromElement(); } diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index 947f4d92b..0a251415f 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -74,7 +74,6 @@ HTMLFormElement::HTMLFormElement(const QualifiedName& tagName, Document* documen , m_isSubmittingOrPreparingForSubmission(false) , m_shouldSubmit(false) , m_isInResetFunction(false) - , m_wasMalformed(false) , m_wasDemoted(false) { ASSERT(hasTagName(formTag)); @@ -687,4 +686,10 @@ void HTMLFormElement::finishParsingChildren() document()->formController()->restoreControlStateIn(*this); } +void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& source) +{ + m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; + HTMLElement::copyNonAttributePropertiesFromElement(source); +} + } // namespace diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index 9d4739423..bf28cca3f 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -73,11 +73,6 @@ public: void submitFromJavaScript(); void reset(); - // Used to indicate a malformed state to keep from applying the bottom margin of the form. - // FIXME: Would probably be better to call this wasUnclosed; that's more specific. - void setMalformed(bool malformed) { m_wasMalformed = malformed; } - bool isMalformed() const { return m_wasMalformed; } - void setDemoted(bool demoted) { m_wasDemoted = demoted; } void submitImplicitly(Event*, bool fromImplicitSubmissionTrigger); @@ -133,6 +128,8 @@ private: virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; } + virtual void copyNonAttributePropertiesFromElement(const Element&) OVERRIDE; + void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger); unsigned formElementIndexWithFormAttribute(Element*, unsigned rangeStart, unsigned rangeEnd); @@ -164,7 +161,6 @@ private: bool m_isInResetFunction; - bool m_wasMalformed; bool m_wasDemoted; }; diff --git a/Source/WebCore/html/HTMLFormElement.idl b/Source/WebCore/html/HTMLFormElement.idl index b6a536c08..86a6f74c6 100644 --- a/Source/WebCore/html/HTMLFormElement.idl +++ b/Source/WebCore/html/HTMLFormElement.idl @@ -18,31 +18,28 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + IndexedGetter, + CustomNamedGetter +] interface HTMLFormElement : HTMLElement { + [Reflect=accept_charset] attribute DOMString acceptCharset; + [Reflect, URL] attribute DOMString action; + [Reflect] attribute DOMString autocomplete; + [TreatNullAs=NullString] attribute DOMString enctype; + [TreatNullAs=NullString] attribute DOMString encoding; + [TreatNullAs=NullString] attribute DOMString method; + [Reflect] attribute DOMString name; + [Reflect] attribute boolean noValidate; + [Reflect] attribute DOMString target; - interface [ - IndexedGetter, - CustomNamedGetter - ] HTMLFormElement : HTMLElement { - attribute [Reflect=accept_charset] DOMString acceptCharset; - attribute [Reflect, URL] DOMString action; - attribute [Reflect] DOMString autocomplete; - attribute [TreatNullAs=NullString] DOMString enctype; - attribute [TreatNullAs=NullString] DOMString encoding; - attribute [TreatNullAs=NullString] DOMString method; - attribute [Reflect] DOMString name; - attribute [Reflect] boolean noValidate; - attribute [Reflect] DOMString target; - - readonly attribute HTMLCollection elements; - readonly attribute long length; + readonly attribute HTMLCollection elements; + readonly attribute long length; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [ImplementedAs=submitFromJavaScript] void submit(); + [ImplementedAs=submitFromJavaScript] void submit(); #else - void submit(); + void submit(); #endif - void reset(); - boolean checkValidity(); - }; -} + void reset(); + boolean checkValidity(); +}; diff --git a/Source/WebCore/html/HTMLFrameElement.idl b/Source/WebCore/html/HTMLFrameElement.idl index f40f7b1c5..e3747da5d 100644 --- a/Source/WebCore/html/HTMLFrameElement.idl +++ b/Source/WebCore/html/HTMLFrameElement.idl @@ -18,37 +18,34 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLFrameElement : HTMLElement { - interface HTMLFrameElement : HTMLElement { + [Reflect] attribute DOMString frameBorder; + [Reflect] attribute DOMString longDesc; + [Reflect] attribute DOMString marginHeight; + [Reflect] attribute DOMString marginWidth; + [Reflect] attribute DOMString name; + [Reflect] attribute boolean noResize; + [Reflect] attribute DOMString scrolling; + [Reflect, URL] attribute DOMString src; - attribute [Reflect] DOMString frameBorder; - attribute [Reflect] DOMString longDesc; - attribute [Reflect] DOMString marginHeight; - attribute [Reflect] DOMString marginWidth; - attribute [Reflect] DOMString name; - attribute [Reflect] boolean noResize; - attribute [Reflect] DOMString scrolling; - attribute [Reflect, URL] DOMString src; + // Introduced in DOM Level 2: + [CheckSecurityForNode] readonly attribute Document contentDocument; - // Introduced in DOM Level 2: - readonly attribute [CheckSecurityForNode] Document contentDocument; - - // Extensions - readonly attribute DOMWindow contentWindow; + // Extensions + readonly attribute DOMWindow contentWindow; #if defined(ENABLE_SVG) && ENABLE_SVG #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C || defined(ENABLE_SVG_DOM_OBJC_BINDINGS) && ENABLE_SVG_DOM_OBJC_BINDINGS - [CheckSecurityForNode] SVGDocument getSVGDocument() - raises(DOMException); + [CheckSecurityForNode] SVGDocument getSVGDocument() + raises(DOMException); #endif #endif - attribute [TreatNullAs=NullString, CustomSetter] DOMString location; + [TreatNullAs=NullString, CustomSetter] attribute DOMString location; - readonly attribute long width; - readonly attribute long height; + readonly attribute long width; + readonly attribute long height; - }; +}; -} diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp index eaa354994..d7882f37c 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.cpp +++ b/Source/WebCore/html/HTMLFrameElementBase.cpp @@ -67,7 +67,7 @@ bool HTMLFrameElementBase::isURLAllowed() const } if (Frame* parentFrame = document()->frame()) { - if (parentFrame->page()->frameCount() >= Page::maxNumberOfFrames) + if (parentFrame->page()->subframeCount() >= Page::maxNumberOfFrames) return false; } diff --git a/Source/WebCore/html/HTMLFrameSetElement.idl b/Source/WebCore/html/HTMLFrameSetElement.idl index a3d4b3ec4..b4fa43da3 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.idl +++ b/Source/WebCore/html/HTMLFrameSetElement.idl @@ -18,40 +18,37 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface [ - CustomNamedGetter - ] HTMLFrameSetElement : HTMLElement { - attribute [Reflect] DOMString cols; - attribute [Reflect] DOMString rows; +[ + CustomNamedGetter +] interface HTMLFrameSetElement : HTMLElement { + [Reflect] attribute DOMString cols; + [Reflect] attribute DOMString rows; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C - // Event handler attributes - attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeunload; - attribute [NotEnumerable, JSWindowEventListener] EventListener onhashchange; - attribute [NotEnumerable, JSWindowEventListener] EventListener onmessage; - attribute [NotEnumerable, JSWindowEventListener] EventListener onoffline; - attribute [NotEnumerable, JSWindowEventListener] EventListener ononline; - attribute [NotEnumerable, JSWindowEventListener] EventListener onpopstate; - attribute [NotEnumerable, JSWindowEventListener] EventListener onresize; - attribute [NotEnumerable, JSWindowEventListener] EventListener onstorage; - attribute [NotEnumerable, JSWindowEventListener] EventListener onunload; + // Event handler attributes + [NotEnumerable, JSWindowEventListener] attribute EventListener onbeforeunload; + [NotEnumerable, JSWindowEventListener] attribute EventListener onhashchange; + [NotEnumerable, JSWindowEventListener] attribute EventListener onmessage; + [NotEnumerable, JSWindowEventListener] attribute EventListener onoffline; + [NotEnumerable, JSWindowEventListener] attribute EventListener ononline; + [NotEnumerable, JSWindowEventListener] attribute EventListener onpopstate; + [NotEnumerable, JSWindowEventListener] attribute EventListener onresize; + [NotEnumerable, JSWindowEventListener] attribute EventListener onstorage; + [NotEnumerable, JSWindowEventListener] attribute EventListener onunload; - attribute [Conditional=ORIENTATION_EVENTS, NotEnumerable, JSWindowEventListener] EventListener onorientationchange; + [Conditional=ORIENTATION_EVENTS, NotEnumerable, JSWindowEventListener] attribute EventListener onorientationchange; - // Overrides of Element attributes (with different implementation in bindings). - attribute [NotEnumerable, JSWindowEventListener] EventListener onblur; - attribute [NotEnumerable, JSWindowEventListener] EventListener onerror; - attribute [NotEnumerable, JSWindowEventListener] EventListener onfocus; - attribute [NotEnumerable, JSWindowEventListener] EventListener onload; + // Overrides of Element attributes (with different implementation in bindings). + [NotEnumerable, JSWindowEventListener] attribute EventListener onblur; + [NotEnumerable, JSWindowEventListener] attribute EventListener onerror; + [NotEnumerable, JSWindowEventListener] attribute EventListener onfocus; + [NotEnumerable, JSWindowEventListener] attribute EventListener onload; - // Not implemented yet. - // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; - // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; - // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; - // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; + // Not implemented yet. + // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLHRElement.idl b/Source/WebCore/html/HTMLHRElement.idl index 23a57da10..babe467cd 100644 --- a/Source/WebCore/html/HTMLHRElement.idl +++ b/Source/WebCore/html/HTMLHRElement.idl @@ -17,13 +17,10 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLHRElement : HTMLElement { + [Reflect] attribute DOMString align; + [Reflect] attribute boolean noShade; + [Reflect] attribute DOMString size; + [Reflect] attribute DOMString width; +}; - interface HTMLHRElement : HTMLElement { - attribute [Reflect] DOMString align; - attribute [Reflect] boolean noShade; - attribute [Reflect] DOMString size; - attribute [Reflect] DOMString width; - }; - -} diff --git a/Source/WebCore/html/HTMLHeadElement.idl b/Source/WebCore/html/HTMLHeadElement.idl index 59bdbf0e7..6a784bdd7 100644 --- a/Source/WebCore/html/HTMLHeadElement.idl +++ b/Source/WebCore/html/HTMLHeadElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLHeadElement : HTMLElement { + [Reflect] attribute DOMString profile; +}; - interface HTMLHeadElement : HTMLElement { - attribute [Reflect] DOMString profile; - }; - -} diff --git a/Source/WebCore/html/HTMLHeadingElement.idl b/Source/WebCore/html/HTMLHeadingElement.idl index e419c1c7d..288f43902 100644 --- a/Source/WebCore/html/HTMLHeadingElement.idl +++ b/Source/WebCore/html/HTMLHeadingElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLHeadingElement : HTMLElement { + [Reflect] attribute DOMString align; +}; - interface HTMLHeadingElement : HTMLElement { - attribute [Reflect] DOMString align; - }; - -} diff --git a/Source/WebCore/html/HTMLHtmlElement.idl b/Source/WebCore/html/HTMLHtmlElement.idl index 03c661cc8..430cdc6f8 100644 --- a/Source/WebCore/html/HTMLHtmlElement.idl +++ b/Source/WebCore/html/HTMLHtmlElement.idl @@ -17,11 +17,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLHtmlElement : HTMLElement { + [Reflect] attribute DOMString version; + [Reflect, URL] attribute DOMString manifest; +}; - interface HTMLHtmlElement : HTMLElement { - attribute [Reflect] DOMString version; - attribute [Reflect, URL] DOMString manifest; - }; - -} diff --git a/Source/WebCore/html/HTMLIFrameElement.idl b/Source/WebCore/html/HTMLIFrameElement.idl index 2dbf38dbe..eea2fb72e 100644 --- a/Source/WebCore/html/HTMLIFrameElement.idl +++ b/Source/WebCore/html/HTMLIFrameElement.idl @@ -18,35 +18,32 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLIFrameElement : HTMLElement { + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString frameBorder; + [Reflect] attribute DOMString height; + [Reflect] attribute DOMString longDesc; + [Reflect] attribute DOMString marginHeight; + [Reflect] attribute DOMString marginWidth; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString sandbox; + [Reflect, Conditional=IFRAME_SEAMLESS] attribute boolean seamless; + [Reflect] attribute DOMString scrolling; + [Reflect, URL] attribute DOMString src; + [Reflect] attribute DOMString srcdoc; + [Reflect] attribute DOMString width; - interface HTMLIFrameElement : HTMLElement { - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString frameBorder; - attribute [Reflect] DOMString height; - attribute [Reflect] DOMString longDesc; - attribute [Reflect] DOMString marginHeight; - attribute [Reflect] DOMString marginWidth; - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString sandbox; - attribute [Reflect, Conditional=IFRAME_SEAMLESS] boolean seamless; - attribute [Reflect] DOMString scrolling; - attribute [Reflect, URL] DOMString src; - attribute [Reflect] DOMString srcdoc; - attribute [Reflect] DOMString width; + // Introduced in DOM Level 2: + [CheckSecurityForNode] readonly attribute Document contentDocument; - // Introduced in DOM Level 2: - readonly attribute [CheckSecurityForNode] Document contentDocument; - - // Extensions - readonly attribute DOMWindow contentWindow; + // Extensions + readonly attribute DOMWindow contentWindow; #if defined(ENABLE_SVG) && ENABLE_SVG #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C || defined(ENABLE_SVG_DOM_OBJC_BINDINGS) && ENABLE_SVG_DOM_OBJC_BINDINGS - [CheckSecurityForNode] SVGDocument getSVGDocument() - raises(DOMException); + [CheckSecurityForNode] SVGDocument getSVGDocument() + raises(DOMException); #endif #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLImageElement.idl b/Source/WebCore/html/HTMLImageElement.idl index d893b6c0c..ce1ea1799 100644 --- a/Source/WebCore/html/HTMLImageElement.idl +++ b/Source/WebCore/html/HTMLImageElement.idl @@ -18,38 +18,35 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface [ - JSGenerateToNativeObject - ] HTMLImageElement : HTMLElement { - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString alt; - attribute [Reflect] DOMString border; - attribute [Reflect] DOMString crossOrigin; - attribute long height; - attribute [Reflect] long hspace; - attribute [Reflect] boolean isMap; - attribute [Reflect, URL] DOMString longDesc; - attribute [Reflect, URL] DOMString src; - attribute [Reflect] DOMString useMap; - attribute [Reflect] long vspace; - attribute long width; - - // Extensions - readonly attribute boolean complete; - attribute [Reflect,URL] DOMString lowsrc; - readonly attribute long naturalHeight; - readonly attribute long naturalWidth; - readonly attribute long x; - readonly attribute long y; +[ + JSGenerateToNativeObject +] interface HTMLImageElement : HTMLElement { + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString alt; + [Reflect] attribute DOMString border; + [Reflect] attribute DOMString crossOrigin; + attribute long height; + [Reflect] attribute long hspace; + [Reflect] attribute boolean isMap; + [Reflect, URL] attribute DOMString longDesc; + [Reflect, URL] attribute DOMString src; + [Reflect] attribute DOMString useMap; + [Reflect] attribute long vspace; + attribute long width; + + // Extensions + readonly attribute boolean complete; + [Reflect,URL] attribute DOMString lowsrc; + readonly attribute long naturalHeight; + readonly attribute long naturalWidth; + readonly attribute long x; + readonly attribute long y; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // Objective-C extension: - readonly attribute DOMString altDisplayString; - readonly attribute URL absoluteImageURL; + // Objective-C extension: + readonly attribute DOMString altDisplayString; + readonly attribute URL absoluteImageURL; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index d1ea76cae..027f60f5e 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -1318,6 +1318,14 @@ void HTMLInputElement::setSize(unsigned size) setAttribute(sizeAttr, String::number(size)); } +void HTMLInputElement::setSize(unsigned size, ExceptionCode& ec) +{ + if (!size) + ec = INDEX_SIZE_ERR; + else + setSize(size); +} + KURL HTMLInputElement::src() const { return document()->completeURL(fastGetAttribute(srcAttr)); diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 7fe0d6c14..4184dc977 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -208,6 +208,7 @@ public: String alt() const; void setSize(unsigned); + void setSize(unsigned, ExceptionCode&); KURL src() const; diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index 879a34f57..3c360477a 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -19,103 +19,100 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLInputElement : HTMLElement { - attribute [Reflect] DOMString accept; - attribute [Reflect] DOMString alt; - attribute [Reflect] DOMString autocomplete; - attribute [Reflect] boolean autofocus; - attribute [Reflect=checked] boolean defaultChecked; - attribute boolean checked; - attribute [Reflect] DOMString dirName; - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute FileList files; - attribute [Reflect, URL] DOMString formAction; - attribute [TreatNullAs=NullString] DOMString formEnctype; - attribute [TreatNullAs=NullString] DOMString formMethod; - attribute [Reflect] boolean formNoValidate; - attribute [Reflect] DOMString formTarget; - attribute unsigned long height; - attribute boolean indeterminate; - readonly attribute [Conditional=DATALIST_ELEMENT] HTMLElement list; - attribute [Reflect] DOMString max; - attribute long maxLength setter raises(DOMException); - attribute [Reflect] DOMString min; - attribute [Reflect] boolean multiple; - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString pattern; - attribute [Reflect] DOMString placeholder; - attribute [Reflect] boolean readOnly; - attribute [Reflect] boolean required; +interface HTMLInputElement : HTMLElement { + [Reflect] attribute DOMString accept; + [Reflect] attribute DOMString alt; + [Reflect] attribute DOMString autocomplete; + [Reflect] attribute boolean autofocus; + [Reflect=checked] attribute boolean defaultChecked; + attribute boolean checked; + [Reflect] attribute DOMString dirName; + [Reflect] attribute boolean disabled; + readonly attribute HTMLFormElement form; + attribute FileList files; + [Reflect, URL] attribute DOMString formAction; + [TreatNullAs=NullString] attribute DOMString formEnctype; + [TreatNullAs=NullString] attribute DOMString formMethod; + [Reflect] attribute boolean formNoValidate; + [Reflect] attribute DOMString formTarget; + attribute unsigned long height; + attribute boolean indeterminate; + [Conditional=DATALIST_ELEMENT] readonly attribute HTMLElement list; + [Reflect] attribute DOMString max; + attribute long maxLength setter raises(DOMException); + [Reflect] attribute DOMString min; + [Reflect] attribute boolean multiple; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString pattern; + [Reflect] attribute DOMString placeholder; + [Reflect] attribute boolean readOnly; + [Reflect] attribute boolean required; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [ObjCImplementedAsUnsignedLong] DOMString size; // DOM level 2 changed this to a long, but ObjC API is a string + [ObjCImplementedAsUnsignedLong] attribute DOMString size; // DOM level 2 changed this to a long, but ObjC API is a string #else - attribute unsigned long size; // Changed string -> long -> unsigned long + attribute unsigned long size setter raises(DOMException); // Changed string -> long -> unsigned long #endif - attribute [Reflect, URL] DOMString src; - attribute [Reflect] DOMString step; - attribute [TreatNullAs=NullString] DOMString type; // readonly dropped as part of DOM level 2 - attribute [TreatNullAs=NullString] DOMString defaultValue; - attribute [TreatNullAs=NullString] DOMString value; + [Reflect, URL] attribute DOMString src; + [Reflect] attribute DOMString step; + [TreatNullAs=NullString] attribute DOMString type; // readonly dropped as part of DOM level 2 + [TreatNullAs=NullString] attribute DOMString defaultValue; + [TreatNullAs=NullString] attribute DOMString value; #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute Date valueAsDate setter raises(DOMException); + attribute Date valueAsDate setter raises(DOMException); #endif - attribute double valueAsNumber setter raises(DOMException); + attribute double valueAsNumber setter raises(DOMException); - void stepUp(in [Optional] long n) raises(DOMException); - void stepDown(in [Optional] long n) raises(DOMException); + void stepUp(in [Optional] long n) raises(DOMException); + void stepDown(in [Optional] long n) raises(DOMException); - attribute unsigned long width; - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); + attribute unsigned long width; + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - readonly attribute NodeList labels; + readonly attribute NodeList labels; - void select(); - attribute [Custom] long selectionStart; - attribute [Custom] long selectionEnd; - attribute [Custom] DOMString selectionDirection; + void select(); + [Custom] attribute long selectionStart; + [Custom] attribute long selectionEnd; + [Custom] attribute DOMString selectionDirection; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - [Custom] void setSelectionRange(in long start, in long end); + [Custom] void setSelectionRange(in long start, in long end); #else - [Custom] void setSelectionRange(in [Optional=DefaultIsUndefined] long start, - in [Optional=DefaultIsUndefined] long end, - in [Optional] DOMString direction); + [Custom] void setSelectionRange(in [Optional=DefaultIsUndefined] long start, + in [Optional=DefaultIsUndefined] long end, + in [Optional] DOMString direction); #endif - // Non-standard attributes - attribute [Reflect] DOMString align; - attribute [Conditional=DIRECTORY_UPLOAD, Reflect] boolean webkitdirectory; - attribute [Reflect] DOMString useMap; - attribute [Reflect] boolean incremental; - attribute [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] boolean webkitSpeech; - attribute [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] boolean webkitGrammar; - attribute [Conditional=INPUT_SPEECH, NotEnumerable] EventListener onwebkitspeechchange; + // Non-standard attributes + [Reflect] attribute DOMString align; + [Conditional=DIRECTORY_UPLOAD, Reflect] attribute boolean webkitdirectory; + [Reflect] attribute DOMString useMap; + [Reflect] attribute boolean incremental; + [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] attribute boolean webkitSpeech; + [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] attribute boolean webkitGrammar; + [Conditional=INPUT_SPEECH, NotEnumerable] attribute EventListener onwebkitspeechchange; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - void click(); + void click(); #endif #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - void setValueForUser(in [TreatNullAs=NullString] DOMString value); + void setValueForUser(in [TreatNullAs=NullString] DOMString value); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // Objective-C extension: - readonly attribute DOMString altDisplayString; - readonly attribute URL absoluteImageURL; + // Objective-C extension: + readonly attribute DOMString altDisplayString; + readonly attribute URL absoluteImageURL; #endif - // See http://www.w3.org/TR/html-media-capture/ - attribute [Conditional=MEDIA_CAPTURE] DOMString capture; - }; -} + // See http://www.w3.org/TR/html-media-capture/ + [Conditional=MEDIA_CAPTURE] attribute DOMString capture; +}; diff --git a/Source/WebCore/html/HTMLIntentElement.idl b/Source/WebCore/html/HTMLIntentElement.idl index 608c5acdd..f1df9be90 100644 --- a/Source/WebCore/html/HTMLIntentElement.idl +++ b/Source/WebCore/html/HTMLIntentElement.idl @@ -23,16 +23,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=WEB_INTENTS_TAG +] interface HTMLIntentElement : HTMLElement { + [Reflect] attribute DOMString action; + [Reflect] attribute DOMString type; + [Reflect, URL] attribute DOMString href; + [Reflect] attribute DOMString title; + [Reflect] attribute DOMString disposition; +}; - interface [ - Conditional=WEB_INTENTS_TAG - ] HTMLIntentElement : HTMLElement { - attribute [Reflect] DOMString action; - attribute [Reflect] DOMString type; - attribute [Reflect, URL] DOMString href; - attribute [Reflect] DOMString title; - attribute [Reflect] DOMString disposition; - }; - -} diff --git a/Source/WebCore/html/HTMLKeygenElement.idl b/Source/WebCore/html/HTMLKeygenElement.idl index fc6f25c81..466d7925f 100644 --- a/Source/WebCore/html/HTMLKeygenElement.idl +++ b/Source/WebCore/html/HTMLKeygenElement.idl @@ -28,25 +28,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +interface HTMLKeygenElement : HTMLElement { + [Reflect] attribute boolean autofocus; + [Reflect] attribute DOMString challenge; + [Reflect] attribute boolean disabled; + readonly attribute HTMLFormElement form; + [Reflect] attribute DOMString keytype; + [Reflect] attribute DOMString name; - interface HTMLKeygenElement : HTMLElement { - attribute [Reflect] boolean autofocus; - attribute [Reflect] DOMString challenge; - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute [Reflect] DOMString keytype; - attribute [Reflect] DOMString name; + readonly attribute DOMString type; - readonly attribute DOMString type; + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); + readonly attribute NodeList labels; +}; - readonly attribute NodeList labels; - }; - -} diff --git a/Source/WebCore/html/HTMLLIElement.cpp b/Source/WebCore/html/HTMLLIElement.cpp index 65f65dc9e..189342099 100644 --- a/Source/WebCore/html/HTMLLIElement.cpp +++ b/Source/WebCore/html/HTMLLIElement.cpp @@ -96,9 +96,9 @@ void HTMLLIElement::attach() // Find the enclosing list node. Node* listNode = 0; - ComposedShadowTreeParentWalker walker(this); + ComposedShadowTreeWalker walker(this); while (!listNode) { - walker.parentIncludingInsertionPointAndShadowRoot(); + walker.parent(); if (!walker.get()) break; if (walker.get()->hasTagName(ulTag) || walker.get()->hasTagName(olTag)) diff --git a/Source/WebCore/html/HTMLLIElement.idl b/Source/WebCore/html/HTMLLIElement.idl index 2dc541b18..ba3eaaebd 100644 --- a/Source/WebCore/html/HTMLLIElement.idl +++ b/Source/WebCore/html/HTMLLIElement.idl @@ -17,11 +17,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLLIElement : HTMLElement { + [Reflect] attribute DOMString type; + [Reflect] attribute long value; +}; - interface HTMLLIElement : HTMLElement { - attribute [Reflect] DOMString type; - attribute [Reflect] long value; - }; - -} diff --git a/Source/WebCore/html/HTMLLabelElement.idl b/Source/WebCore/html/HTMLLabelElement.idl index bf79680f8..92e5f4ba7 100644 --- a/Source/WebCore/html/HTMLLabelElement.idl +++ b/Source/WebCore/html/HTMLLabelElement.idl @@ -18,15 +18,12 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLLabelElement : HTMLElement { - readonly attribute HTMLFormElement form; - attribute [Reflect=for] DOMString htmlFor; - readonly attribute HTMLElement control; +interface HTMLLabelElement : HTMLElement { + readonly attribute HTMLFormElement form; + [Reflect=for] attribute DOMString htmlFor; + readonly attribute HTMLElement control; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLLegendElement.idl b/Source/WebCore/html/HTMLLegendElement.idl index bf755a5bb..749745e4b 100644 --- a/Source/WebCore/html/HTMLLegendElement.idl +++ b/Source/WebCore/html/HTMLLegendElement.idl @@ -18,14 +18,11 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLLegendElement : HTMLElement { - readonly attribute HTMLFormElement form; - attribute [Reflect] DOMString align; +interface HTMLLegendElement : HTMLElement { + readonly attribute HTMLFormElement form; + [Reflect] attribute DOMString align; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLLinkElement.idl b/Source/WebCore/html/HTMLLinkElement.idl index 8d16f25e8..0a4e34759 100644 --- a/Source/WebCore/html/HTMLLinkElement.idl +++ b/Source/WebCore/html/HTMLLinkElement.idl @@ -19,29 +19,26 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLLinkElement : HTMLElement { - attribute [Reflect] boolean disabled; - attribute [Reflect] DOMString charset; - attribute [Reflect, URL] DOMString href; - attribute [Reflect] DOMString hreflang; - attribute [Reflect] DOMString media; - attribute [Reflect] DOMString rel; - attribute [Reflect] DOMString rev; +interface HTMLLinkElement : HTMLElement { + [Reflect] attribute boolean disabled; + [Reflect] attribute DOMString charset; + [Reflect, URL] attribute DOMString href; + [Reflect] attribute DOMString hreflang; + [Reflect] attribute DOMString media; + [Reflect] attribute DOMString rel; + [Reflect] attribute DOMString rev; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [Custom] DOMSettableTokenList sizes; + [Custom] attribute DOMSettableTokenList sizes; #endif - attribute [Reflect] DOMString target; - attribute [Reflect] DOMString type; + [Reflect] attribute DOMString target; + [Reflect] attribute DOMString type; - // DOM Level 2 Style - readonly attribute StyleSheet sheet; + // DOM Level 2 Style + readonly attribute StyleSheet sheet; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // Objective-C extension: - readonly attribute URL absoluteLinkURL; + // Objective-C extension: + readonly attribute URL absoluteLinkURL; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLMapElement.idl b/Source/WebCore/html/HTMLMapElement.idl index 7811c9a9f..01dcae007 100644 --- a/Source/WebCore/html/HTMLMapElement.idl +++ b/Source/WebCore/html/HTMLMapElement.idl @@ -18,11 +18,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLMapElement : HTMLElement { + readonly attribute HTMLCollection areas; + [Reflect] attribute DOMString name; +}; - interface HTMLMapElement : HTMLElement { - readonly attribute HTMLCollection areas; - attribute [Reflect] DOMString name; - }; - -} diff --git a/Source/WebCore/html/HTMLMarqueeElement.idl b/Source/WebCore/html/HTMLMarqueeElement.idl index 3174facbc..41bd01906 100644 --- a/Source/WebCore/html/HTMLMarqueeElement.idl +++ b/Source/WebCore/html/HTMLMarqueeElement.idl @@ -17,28 +17,25 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLMarqueeElement : HTMLElement { + void start(); + void stop(); + + [Reflect] attribute DOMString behavior; + [Reflect] attribute DOMString bgColor; + [Reflect] attribute DOMString direction; + [Reflect] attribute DOMString height; + [Reflect] attribute unsigned long hspace; + attribute long loop setter raises(DOMException); + attribute long scrollAmount setter raises(DOMException); + attribute long scrollDelay setter raises(DOMException); + [Reflect] attribute boolean trueSpeed; + [Reflect] attribute unsigned long vspace; + [Reflect] attribute DOMString width; - interface HTMLMarqueeElement : HTMLElement { - void start(); - void stop(); - - attribute [Reflect] DOMString behavior; - attribute [Reflect] DOMString bgColor; - attribute [Reflect] DOMString direction; - attribute [Reflect] DOMString height; - attribute [Reflect] unsigned long hspace; - attribute long loop setter raises(DOMException); - attribute long scrollAmount setter raises(DOMException); - attribute long scrollDelay setter raises(DOMException); - attribute [Reflect] boolean trueSpeed; - attribute [Reflect] unsigned long vspace; - attribute [Reflect] DOMString width; - - // FIXME: Implement the following event handler attributes - // https://bugs.webkit.org/show_bug.cgi?id=49788 - // attribute EventListener onbounce; - // attribute EventListener onfinish; - // attribute EventListener onstart; - }; -} + // FIXME: Implement the following event handler attributes + // https://bugs.webkit.org/show_bug.cgi?id=49788 + // attribute EventListener onbounce; + // attribute EventListener onfinish; + // attribute EventListener onstart; +}; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 66b8c4655..ebeee1b40 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -756,7 +756,7 @@ void HTMLMediaElement::loadInternal() // Some of the code paths below this function dispatch the BeforeLoad event. This ASSERT helps // us catch those bugs more quickly without needing all the branches to align to actually // trigger the event. - ASSERT(!eventDispatchForbidden()); + ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); // If we can't start a load right away, start it later. Page* page = document()->page(); @@ -1834,8 +1834,14 @@ void HTMLMediaElement::mediaPlayerKeyMessage(MediaPlayer*, const String& keySyst m_asyncEventQueue->enqueueEvent(event.release()); } -void HTMLMediaElement::mediaPlayerKeyNeeded(MediaPlayer*, const String& keySystem, const String& sessionId, const unsigned char* initData, unsigned initDataLength) +bool HTMLMediaElement::mediaPlayerKeyNeeded(MediaPlayer*, const String& keySystem, const String& sessionId, const unsigned char* initData, unsigned initDataLength) { + if (!hasEventListeners(eventNames().webkitneedkeyEvent)) { + m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED); + scheduleEvent(eventNames().errorEvent); + return false; + } + MediaKeyEventInit initializer; initializer.keySystem = keySystem; initializer.sessionId = sessionId; @@ -1846,6 +1852,7 @@ void HTMLMediaElement::mediaPlayerKeyNeeded(MediaPlayer*, const String& keySyste RefPtr<Event> event = MediaKeyEvent::create(eventNames().webkitneedkeyEvent, initializer); event->setTarget(this); m_asyncEventQueue->enqueueEvent(event.release()); + return true; } #endif diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 821e2285b..b698c6b2d 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -415,7 +415,7 @@ private: virtual void mediaPlayerKeyAdded(MediaPlayer*, const String& keySystem, const String& sessionId) OVERRIDE; virtual void mediaPlayerKeyError(MediaPlayer*, const String& keySystem, const String& sessionId, MediaPlayerClient::MediaKeyErrorCode, unsigned short systemCode) OVERRIDE; virtual void mediaPlayerKeyMessage(MediaPlayer*, const String& keySystem, const String& sessionId, const unsigned char* message, unsigned messageLength) OVERRIDE; - virtual void mediaPlayerKeyNeeded(MediaPlayer*, const String& keySystem, const String& sessionId, const unsigned char* initData, unsigned initDataLength) OVERRIDE; + virtual bool mediaPlayerKeyNeeded(MediaPlayer*, const String& keySystem, const String& sessionId, const unsigned char* initData, unsigned initDataLength) OVERRIDE; #endif virtual String mediaPlayerReferrer() const OVERRIDE; diff --git a/Source/WebCore/html/HTMLMediaElement.idl b/Source/WebCore/html/HTMLMediaElement.idl index b6a0a636f..ece0f5348 100644 --- a/Source/WebCore/html/HTMLMediaElement.idl +++ b/Source/WebCore/html/HTMLMediaElement.idl @@ -23,99 +23,97 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=VIDEO, - JSGenerateToNativeObject - ] HTMLMediaElement : HTMLElement { +[ + Conditional=VIDEO, + JSGenerateToNativeObject +] interface HTMLMediaElement : HTMLElement { - // error state - readonly attribute MediaError error; +// error state +readonly attribute MediaError error; - // network state - attribute [Reflect, URL] DOMString src; - readonly attribute [URL] DOMString currentSrc; - - const unsigned short NETWORK_EMPTY = 0; - const unsigned short NETWORK_IDLE = 1; - const unsigned short NETWORK_LOADING = 2; - const unsigned short NETWORK_NO_SOURCE = 3; - readonly attribute unsigned short networkState; - attribute DOMString preload; +// network state +attribute [Reflect, URL] DOMString src; +readonly attribute [URL] DOMString currentSrc; - readonly attribute TimeRanges buffered; - void load() - raises (DOMException); +const unsigned short NETWORK_EMPTY = 0; +const unsigned short NETWORK_IDLE = 1; +const unsigned short NETWORK_LOADING = 2; +const unsigned short NETWORK_NO_SOURCE = 3; +readonly attribute unsigned short networkState; +attribute DOMString preload; + +readonly attribute TimeRanges buffered; +void load() + raises (DOMException); #if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA - DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type, in [Optional=DefaultIsNullString, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem); +DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type, in [Optional=DefaultIsUndefined, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem); #else - DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type); +DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type); #endif - // ready state - const unsigned short HAVE_NOTHING = 0; - const unsigned short HAVE_METADATA = 1; - const unsigned short HAVE_CURRENT_DATA = 2; - const unsigned short HAVE_FUTURE_DATA = 3; - const unsigned short HAVE_ENOUGH_DATA = 4; - readonly attribute unsigned short readyState; - readonly attribute boolean seeking; +// ready state +const unsigned short HAVE_NOTHING = 0; +const unsigned short HAVE_METADATA = 1; +const unsigned short HAVE_CURRENT_DATA = 2; +const unsigned short HAVE_FUTURE_DATA = 3; +const unsigned short HAVE_ENOUGH_DATA = 4; +readonly attribute unsigned short readyState; +readonly attribute boolean seeking; - // playback state - attribute float currentTime - setter raises (DOMException); - readonly attribute double initialTime; - readonly attribute float startTime; - readonly attribute float duration; - readonly attribute boolean paused; - attribute float defaultPlaybackRate; - attribute float playbackRate; - readonly attribute TimeRanges played; - readonly attribute TimeRanges seekable; - readonly attribute boolean ended; - attribute [Reflect] boolean autoplay; - attribute [Reflect] boolean loop; - void play(); - void pause(); +// playback state +attribute float currentTime + setter raises (DOMException); +readonly attribute double initialTime; +readonly attribute float startTime; +readonly attribute float duration; +readonly attribute boolean paused; +attribute float defaultPlaybackRate; +attribute float playbackRate; +readonly attribute TimeRanges played; +readonly attribute TimeRanges seekable; +readonly attribute boolean ended; +attribute [Reflect] boolean autoplay; +attribute [Reflect] boolean loop; +void play(); +void pause(); - // controls - attribute boolean controls; - attribute float volume - setter raises (DOMException); - attribute boolean muted; - attribute [Reflect=muted] boolean defaultMuted; +// controls +attribute boolean controls; +attribute float volume + setter raises (DOMException); +attribute boolean muted; +attribute [Reflect=muted] boolean defaultMuted; - // WebKit extensions - attribute boolean webkitPreservesPitch; +// WebKit extensions +attribute boolean webkitPreservesPitch; - readonly attribute boolean webkitHasClosedCaptions; - attribute boolean webkitClosedCaptionsVisible; +readonly attribute boolean webkitHasClosedCaptions; +attribute boolean webkitClosedCaptionsVisible; - // The number of bytes consumed by the media decoder. - readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitAudioDecodedByteCount; - readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitVideoDecodedByteCount; +// The number of bytes consumed by the media decoder. +readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitAudioDecodedByteCount; +readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitVideoDecodedByteCount; #if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA - [V8EnabledAtRuntime=encryptedMedia] void webkitGenerateKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in [Optional] Uint8Array initData) - raises (DOMException); - [V8EnabledAtRuntime=encryptedMedia] void webkitAddKey(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in Uint8Array key, in [Optional] Uint8Array initData, in [Optional=DefaultIsNullString] DOMString sessionId) - raises (DOMException); - [V8EnabledAtRuntime=encryptedMedia] void webkitCancelKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in [Optional=DefaultIsNullString] DOMString sessionId) - raises (DOMException); +[V8EnabledAtRuntime=encryptedMedia] void webkitGenerateKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in [Optional] Uint8Array initData) + raises (DOMException); +[V8EnabledAtRuntime=encryptedMedia] void webkitAddKey(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in Uint8Array key, in [Optional] Uint8Array initData, in [Optional=DefaultIsNullString] DOMString sessionId) + raises (DOMException); +[V8EnabledAtRuntime=encryptedMedia] void webkitCancelKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in [Optional=DefaultIsNullString] DOMString sessionId) + raises (DOMException); - attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitkeyadded; - attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitkeyerror; - attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitkeymessage; - attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitneedkey; +[V8EnabledAtRuntime=encryptedMedia] attribute EventListener onwebkitkeyadded; +attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitkeyerror; +attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitkeymessage; +attribute [V8EnabledAtRuntime=encryptedMedia] EventListener onwebkitneedkey; #endif #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK - [V8EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) - raises (DOMException); - readonly attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; +[V8EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) + raises (DOMException); +readonly attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; #endif - attribute [Reflect, TreatNullAs=NullString] DOMString mediaGroup; - attribute [CustomSetter] MediaController controller; +[Reflect, TreatNullAs=NullString] attribute DOMString mediaGroup; +attribute [CustomSetter] MediaController controller; }; -} diff --git a/Source/WebCore/html/HTMLMenuElement.idl b/Source/WebCore/html/HTMLMenuElement.idl index ff14754c0..ea756fcae 100644 --- a/Source/WebCore/html/HTMLMenuElement.idl +++ b/Source/WebCore/html/HTMLMenuElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLMenuElement : HTMLElement { + [Reflect] attribute boolean compact; +}; - interface HTMLMenuElement : HTMLElement { - attribute [Reflect] boolean compact; - }; - -} diff --git a/Source/WebCore/html/HTMLMetaElement.idl b/Source/WebCore/html/HTMLMetaElement.idl index f4ffb2d42..4f7e9cd00 100644 --- a/Source/WebCore/html/HTMLMetaElement.idl +++ b/Source/WebCore/html/HTMLMetaElement.idl @@ -17,13 +17,10 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLMetaElement : HTMLElement { + [Reflect] attribute DOMString content; + [Reflect=http_equiv] attribute DOMString httpEquiv; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString scheme; +}; - interface HTMLMetaElement : HTMLElement { - attribute [Reflect] DOMString content; - attribute [Reflect=http_equiv] DOMString httpEquiv; - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString scheme; - }; - -} diff --git a/Source/WebCore/html/HTMLMeterElement.idl b/Source/WebCore/html/HTMLMeterElement.idl index 8d3e1074c..85d1b5104 100644 --- a/Source/WebCore/html/HTMLMeterElement.idl +++ b/Source/WebCore/html/HTMLMeterElement.idl @@ -17,23 +17,20 @@ * Boston, MA 02110-1301, USA. */ -module html { - interface [ - Conditional=METER_ELEMENT - ] 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 NodeList labels; - }; -} - +[ + Conditional=METER_ELEMENT +] interface 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 NodeList labels; +}; diff --git a/Source/WebCore/html/HTMLModElement.idl b/Source/WebCore/html/HTMLModElement.idl index ad8281c45..ccb8da466 100644 --- a/Source/WebCore/html/HTMLModElement.idl +++ b/Source/WebCore/html/HTMLModElement.idl @@ -17,11 +17,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLModElement : HTMLElement { + [Reflect, URL] attribute DOMString cite; + [Reflect] attribute DOMString dateTime; +}; - interface HTMLModElement : HTMLElement { - attribute [Reflect, URL] DOMString cite; - attribute [Reflect] DOMString dateTime; - }; - -} diff --git a/Source/WebCore/html/HTMLOListElement.idl b/Source/WebCore/html/HTMLOListElement.idl index 8d1d3a46f..1e5161556 100644 --- a/Source/WebCore/html/HTMLOListElement.idl +++ b/Source/WebCore/html/HTMLOListElement.idl @@ -17,13 +17,10 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLOListElement : HTMLElement { + [Reflect] attribute boolean compact; + attribute long start; + [Reflect] attribute boolean reversed; + [Reflect] attribute DOMString type; +}; - interface HTMLOListElement : HTMLElement { - attribute [Reflect] boolean compact; - attribute long start; - attribute [Reflect] boolean reversed; - attribute [Reflect] DOMString type; - }; - -} diff --git a/Source/WebCore/html/HTMLObjectElement.idl b/Source/WebCore/html/HTMLObjectElement.idl index f1055fdb8..c3c9cad7a 100644 --- a/Source/WebCore/html/HTMLObjectElement.idl +++ b/Source/WebCore/html/HTMLObjectElement.idl @@ -18,49 +18,46 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + CustomNamedSetter, + JSCustomGetOwnPropertySlotAndDescriptor, + CustomCall +] interface HTMLObjectElement : HTMLElement { + readonly attribute HTMLFormElement form; + [Reflect] attribute DOMString code; + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString archive; + [Reflect] attribute DOMString border; + [Reflect] attribute DOMString codeBase; + [Reflect] attribute DOMString codeType; + [Reflect, URL] attribute DOMString data; + [Reflect] attribute boolean declare; + [Reflect] attribute DOMString height; + [Reflect] attribute long hspace; + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString standby; + [Reflect] attribute DOMString type; + [Reflect] attribute DOMString useMap; + [Reflect] attribute long vspace; + [Reflect] attribute DOMString width; + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - interface [ - CustomNamedSetter, - JSCustomGetOwnPropertySlotAndDescriptor, - CustomCall - ] HTMLObjectElement : HTMLElement { - readonly attribute HTMLFormElement form; - attribute [Reflect] DOMString code; - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString archive; - attribute [Reflect] DOMString border; - attribute [Reflect] DOMString codeBase; - attribute [Reflect] DOMString codeType; - attribute [Reflect, URL] DOMString data; - attribute [Reflect] boolean declare; - attribute [Reflect] DOMString height; - attribute [Reflect] long hspace; - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString standby; - attribute [Reflect] DOMString type; - attribute [Reflect] DOMString useMap; - attribute [Reflect] long vspace; - attribute [Reflect] DOMString width; - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - - // Introduced in DOM Level 2: - readonly attribute [CheckSecurityForNode] Document contentDocument; + // Introduced in DOM Level 2: + [CheckSecurityForNode] readonly attribute Document contentDocument; #if defined(ENABLE_SVG) && ENABLE_SVG #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C || defined(ENABLE_SVG_DOM_OBJC_BINDINGS) && ENABLE_SVG_DOM_OBJC_BINDINGS - [CheckSecurityForNode] SVGDocument getSVGDocument() raises(DOMException); + [CheckSecurityForNode] SVGDocument getSVGDocument() raises(DOMException); #endif #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // Objective-C extension: - readonly attribute URL absoluteImageURL; + // Objective-C extension: + readonly attribute URL absoluteImageURL; #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLOptGroupElement.idl b/Source/WebCore/html/HTMLOptGroupElement.idl index 75cead0fb..26a782fd5 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.idl +++ b/Source/WebCore/html/HTMLOptGroupElement.idl @@ -17,11 +17,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLOptGroupElement : HTMLElement { + [Reflect] attribute boolean disabled; + [Reflect] attribute DOMString label; +}; - interface HTMLOptGroupElement : HTMLElement { - attribute [Reflect] boolean disabled; - attribute [Reflect] DOMString label; - }; - -} diff --git a/Source/WebCore/html/HTMLOptionElement.idl b/Source/WebCore/html/HTMLOptionElement.idl index b7b3489ea..d805392a0 100644 --- a/Source/WebCore/html/HTMLOptionElement.idl +++ b/Source/WebCore/html/HTMLOptionElement.idl @@ -18,25 +18,22 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface [ - JSGenerateToNativeObject, - NamedConstructor=Option(in [Optional=DefaultIsNullString] DOMString data, in [Optional=DefaultIsNullString] DOMString value, in [Optional=DefaultIsUndefined] boolean defaultSelected, in [Optional=DefaultIsUndefined] boolean selected), - ConstructorRaisesException - ] HTMLOptionElement : HTMLElement { - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute DOMString label; - attribute [Reflect=selected] boolean defaultSelected; - attribute boolean selected; - attribute DOMString value; +[ + JSGenerateToNativeObject, + NamedConstructor=Option(in [Optional=DefaultIsNullString] DOMString data, in [Optional=DefaultIsNullString] DOMString value, in [Optional=DefaultIsUndefined] boolean defaultSelected, in [Optional=DefaultIsUndefined] boolean selected), + ConstructorRaisesException +] interface HTMLOptionElement : HTMLElement { + [Reflect] attribute boolean disabled; + readonly attribute HTMLFormElement form; + attribute DOMString label; + [Reflect=selected] attribute boolean defaultSelected; + attribute boolean selected; + attribute DOMString value; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute DOMString text setter raises(DOMException); + attribute DOMString text setter raises(DOMException); #else - readonly attribute DOMString text; + readonly attribute DOMString text; #endif - readonly attribute long index; - }; -} + readonly attribute long index; +}; diff --git a/Source/WebCore/html/HTMLOptionsCollection.idl b/Source/WebCore/html/HTMLOptionsCollection.idl index 0476e65fc..b1dc9f1dd 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.idl +++ b/Source/WebCore/html/HTMLOptionsCollection.idl @@ -18,25 +18,22 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + JSGenerateToNativeObject, + CustomIndexedSetter +] interface HTMLOptionsCollection : HTMLCollection { + attribute long selectedIndex; + [Custom] attribute unsigned long length + setter raises (DOMException); - interface [ - JSGenerateToNativeObject, - CustomIndexedSetter - ] HTMLOptionsCollection : HTMLCollection { - attribute long selectedIndex; - attribute [Custom] unsigned long length - setter raises (DOMException); - - [Custom] void add(in [Optional=DefaultIsUndefined] HTMLOptionElement option, - in [Optional] unsigned long index) - raises (DOMException); - [Custom] void remove(in [Optional=DefaultIsUndefined] unsigned long index); + [Custom] void add(in [Optional=DefaultIsUndefined] HTMLOptionElement option, + in [Optional] unsigned long index) + raises (DOMException); + [Custom] void remove(in [Optional=DefaultIsUndefined] unsigned long index); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - Node item(in unsigned long index); - Node namedItem(in DOMString name); + Node item(in unsigned long index); + Node namedItem(in DOMString name); #endif - }; +}; -} diff --git a/Source/WebCore/html/HTMLOutputElement.idl b/Source/WebCore/html/HTMLOutputElement.idl index 35761c335..ea8312abc 100644 --- a/Source/WebCore/html/HTMLOutputElement.idl +++ b/Source/WebCore/html/HTMLOutputElement.idl @@ -22,22 +22,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface HTMLOutputElement : HTMLElement { - attribute [Custom] DOMSettableTokenList htmlFor; - readonly attribute HTMLFormElement form; - attribute [Reflect] DOMString name; +interface HTMLOutputElement : HTMLElement { + [Custom] attribute DOMSettableTokenList htmlFor; + readonly attribute HTMLFormElement form; + [Reflect] attribute DOMString name; - readonly attribute DOMString type; - attribute [TreatNullAs=NullString] DOMString defaultValue; - attribute [TreatNullAs=NullString] DOMString value; + readonly attribute DOMString type; + [TreatNullAs=NullString] attribute DOMString defaultValue; + [TreatNullAs=NullString] attribute DOMString value; - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - readonly attribute NodeList labels; - }; -} + readonly attribute NodeList labels; +}; diff --git a/Source/WebCore/html/HTMLParagraphElement.idl b/Source/WebCore/html/HTMLParagraphElement.idl index 246e9e99e..e6bd9e8bd 100644 --- a/Source/WebCore/html/HTMLParagraphElement.idl +++ b/Source/WebCore/html/HTMLParagraphElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLParagraphElement : HTMLElement { + [Reflect] attribute DOMString align; +}; - interface HTMLParagraphElement : HTMLElement { - attribute [Reflect] DOMString align; - }; - -} diff --git a/Source/WebCore/html/HTMLParamElement.idl b/Source/WebCore/html/HTMLParamElement.idl index 1f0c0ded6..fea259445 100644 --- a/Source/WebCore/html/HTMLParamElement.idl +++ b/Source/WebCore/html/HTMLParamElement.idl @@ -17,13 +17,10 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLParamElement : HTMLElement { + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString type; + [Reflect] attribute DOMString value; + [Reflect] attribute DOMString valueType; +}; - interface HTMLParamElement : HTMLElement { - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString type; - attribute [Reflect] DOMString value; - attribute [Reflect] DOMString valueType; - }; - -} diff --git a/Source/WebCore/html/HTMLPlugInElement.cpp b/Source/WebCore/html/HTMLPlugInElement.cpp index 1b5843483..9947a736e 100644 --- a/Source/WebCore/html/HTMLPlugInElement.cpp +++ b/Source/WebCore/html/HTMLPlugInElement.cpp @@ -35,6 +35,7 @@ #include "Page.h" #include "PluginViewBase.h" #include "RenderEmbeddedObject.h" +#include "RenderSnapshottedPlugIn.h" #include "RenderWidget.h" #include "Settings.h" #include "Widget.h" @@ -55,6 +56,7 @@ HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document* doc , m_NPObject(0) #endif , m_isCapturingMouseEvents(false) + , m_displayState(Playing) { } @@ -176,9 +178,15 @@ void HTMLPlugInElement::defaultEventHandler(Event* event) // FIXME: Mouse down and scroll events are passed down to plug-in via custom code in EventHandler; these code paths should be united. RenderObject* r = renderer(); - if (r && r->isEmbeddedObject() && toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) { - toRenderEmbeddedObject(r)->handleUnavailablePluginIndicatorEvent(event); - return; + if (r && r->isEmbeddedObject()) { + if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) { + toRenderEmbeddedObject(r)->handleUnavailablePluginIndicatorEvent(event); + return; + } + if (r->isSnapshottedPlugIn() && displayState() < Playing) { + toRenderSnapshottedPlugIn(r)->handleEvent(event); + return; + } } if (!r || !r->isWidget()) diff --git a/Source/WebCore/html/HTMLPlugInElement.h b/Source/WebCore/html/HTMLPlugInElement.h index eeec60cb5..d7bcb166e 100644 --- a/Source/WebCore/html/HTMLPlugInElement.h +++ b/Source/WebCore/html/HTMLPlugInElement.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -24,6 +24,7 @@ #define HTMLPlugInElement_h #include "HTMLFrameOwnerElement.h" +#include "Image.h" #include "ImageLoaderClient.h" #include "ScriptInstance.h" @@ -37,7 +38,7 @@ class RenderEmbeddedObject; class RenderWidget; class Widget; -class HTMLPlugInElement : public HTMLFrameOwnerElement, public ImageLoaderClientBase<HTMLPlugInElement> { +class HTMLPlugInElement : public HTMLFrameOwnerElement { public: virtual ~HTMLPlugInElement(); @@ -47,6 +48,15 @@ public: Widget* pluginWidget() const; + enum DisplayState { + WaitingForSnapshot, + DisplayingSnapshot, + Playing + }; + DisplayState displayState() const { return m_displayState; } + void setDisplayState(DisplayState state) { m_displayState = state; } + virtual void updateSnapshot(PassRefPtr<Image>) { } + #if ENABLE(NETSCAPE_PLUGIN_API) NPObject* getNPObject(); #endif @@ -84,6 +94,8 @@ private: NPObject* m_NPObject; #endif bool m_isCapturingMouseEvents; + + DisplayState m_displayState; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLPlugInImageElement.cpp b/Source/WebCore/html/HTMLPlugInImageElement.cpp index 4954e36d5..7e7c27513 100644 --- a/Source/WebCore/html/HTMLPlugInImageElement.cpp +++ b/Source/WebCore/html/HTMLPlugInImageElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -31,7 +31,9 @@ #include "Page.h" #include "RenderEmbeddedObject.h" #include "RenderImage.h" +#include "RenderSnapshottedPlugIn.h" #include "SecurityOrigin.h" +#include "Settings.h" #include "StyleResolver.h" namespace WebCore { @@ -47,6 +49,9 @@ HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Doc , m_needsDocumentActivationCallbacks(false) { setHasCustomCallbacks(); + + if (document->page() && document->page()->settings()->plugInSnapshottingEnabled()) + setDisplayState(WaitingForSnapshot); } HTMLPlugInImageElement::~HTMLPlugInImageElement() @@ -83,7 +88,7 @@ bool HTMLPlugInImageElement::allowedToLoadFrameURL(const String& url) { ASSERT(document()); ASSERT(document()->frame()); - if (document()->frame()->page()->frameCount() >= Page::maxNumberOfFrames) + if (document()->frame()->page()->subframeCount() >= Page::maxNumberOfFrames) return false; KURL completeURL = document()->completeURL(url); @@ -141,6 +146,9 @@ RenderObject* HTMLPlugInImageElement::createRenderer(RenderArena* arena, RenderS image->setImageResource(RenderImageResource::create()); return image; } + + if (document()->page() && document()->page()->settings()->plugInSnapshottingEnabled()) + return new (arena) RenderSnapshottedPlugIn(this); return new (arena) RenderEmbeddedObject(this); } @@ -253,4 +261,13 @@ void HTMLPlugInImageElement::updateWidgetCallback(Node* n, unsigned) static_cast<HTMLPlugInImageElement*>(n)->updateWidgetIfNecessary(); } +void HTMLPlugInImageElement::updateSnapshot(PassRefPtr<Image> image) +{ + if (displayState() > WaitingForSnapshot || !renderer()->isSnapshottedPlugIn()) + return; + + toRenderSnapshottedPlugIn(renderer())->updateSnapshot(image); + setDisplayState(DisplayingSnapshot); +} + } // namespace WebCore diff --git a/Source/WebCore/html/HTMLPlugInImageElement.h b/Source/WebCore/html/HTMLPlugInImageElement.h index 168ed4634..95fbd8a79 100644 --- a/Source/WebCore/html/HTMLPlugInImageElement.h +++ b/Source/WebCore/html/HTMLPlugInImageElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009, 2011, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -42,7 +42,7 @@ enum PreferPlugInsForImagesOption { }; // Base class for HTMLObjectElement and HTMLEmbedElement -class HTMLPlugInImageElement : public HTMLPlugInElement { +class HTMLPlugInImageElement : public HTMLPlugInElement, public ImageLoaderClientBase<HTMLPlugInImageElement> { public: virtual ~HTMLPlugInImageElement(); @@ -90,6 +90,8 @@ private: void updateWidgetIfNecessary(); virtual bool useFallbackContent() const { return false; } + virtual void updateSnapshot(PassRefPtr<Image>) OVERRIDE; + bool m_needsWidgetUpdate; bool m_shouldPreferPlugInsForImages; bool m_needsDocumentActivationCallbacks; diff --git a/Source/WebCore/html/HTMLPreElement.idl b/Source/WebCore/html/HTMLPreElement.idl index ae137f024..807248c0c 100644 --- a/Source/WebCore/html/HTMLPreElement.idl +++ b/Source/WebCore/html/HTMLPreElement.idl @@ -18,15 +18,12 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLPreElement : HTMLElement { + // FIXME: DOM spec says that width should be of type DOMString + // see http://bugs.webkit.org/show_bug.cgi?id=8992 + [Reflect] attribute long width; + + // Extensions + [Reflect] attribute boolean wrap; +}; - interface HTMLPreElement : HTMLElement { - // FIXME: DOM spec says that width should be of type DOMString - // see http://bugs.webkit.org/show_bug.cgi?id=8992 - attribute [Reflect] long width; - - // Extensions - attribute [Reflect] boolean wrap; - }; - -} diff --git a/Source/WebCore/html/HTMLProgressElement.idl b/Source/WebCore/html/HTMLProgressElement.idl index 6ad1ab53e..23a94fadc 100644 --- a/Source/WebCore/html/HTMLProgressElement.idl +++ b/Source/WebCore/html/HTMLProgressElement.idl @@ -17,16 +17,14 @@ * Boston, MA 02110-1301, USA. */ -module html { - interface [ - Conditional=PROGRESS_ELEMENT - ] HTMLProgressElement : HTMLElement { - attribute double value - setter raises(DOMException); - attribute double max - setter raises(DOMException); - readonly attribute double position; - readonly attribute NodeList labels; - }; +[ + Conditional=PROGRESS_ELEMENT +] interface HTMLProgressElement : HTMLElement { + attribute double value + setter raises(DOMException); + attribute double max + setter raises(DOMException); + readonly attribute double position; + readonly attribute NodeList labels; +}; -} diff --git a/Source/WebCore/html/HTMLPropertiesCollection.idl b/Source/WebCore/html/HTMLPropertiesCollection.idl index 760f53acf..05acae119 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.idl +++ b/Source/WebCore/html/HTMLPropertiesCollection.idl @@ -28,18 +28,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=MICRODATA, + JSGenerateToJSObject, + IndexedGetter, + NamedGetter +] interface HTMLPropertiesCollection : HTMLCollection { + readonly attribute unsigned long length; + Node item(in unsigned long index); - interface [ - Conditional=MICRODATA, - JSGenerateToJSObject, - IndexedGetter, - NamedGetter - ] HTMLPropertiesCollection : HTMLCollection { - readonly attribute unsigned long length; - Node item(in unsigned long index); - - readonly attribute DOMStringList names; - PropertyNodeList namedItem(in DOMString name); - }; -} + readonly attribute DOMStringList names; + PropertyNodeList namedItem(in DOMString name); +}; diff --git a/Source/WebCore/html/HTMLQuoteElement.idl b/Source/WebCore/html/HTMLQuoteElement.idl index fa1bcdb57..c53a1a2f1 100644 --- a/Source/WebCore/html/HTMLQuoteElement.idl +++ b/Source/WebCore/html/HTMLQuoteElement.idl @@ -17,9 +17,6 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLQuoteElement : HTMLElement { - attribute [Reflect, URL] DOMString cite; - }; -} +interface HTMLQuoteElement : HTMLElement { + [Reflect, URL] attribute DOMString cite; +}; diff --git a/Source/WebCore/html/HTMLScriptElement.idl b/Source/WebCore/html/HTMLScriptElement.idl index ba16e851c..1365d12bf 100644 --- a/Source/WebCore/html/HTMLScriptElement.idl +++ b/Source/WebCore/html/HTMLScriptElement.idl @@ -17,18 +17,15 @@ * Boston, MA 02110-1301, USA. */ -module html { - - interface HTMLScriptElement : HTMLElement { - attribute [TreatNullAs=NullString] DOMString text; - attribute [Reflect=for] DOMString htmlFor; - attribute [Reflect] DOMString event; - attribute [Reflect] DOMString charset; - attribute boolean async; - attribute [Reflect] boolean defer; - attribute [Reflect, URL] DOMString src; - attribute [Reflect] DOMString type; - attribute [Reflect] DOMString crossOrigin; - attribute [Reflect, Conditional=CSP_NEXT] DOMString nonce; - }; -} +interface HTMLScriptElement : HTMLElement { + [TreatNullAs=NullString] attribute DOMString text; + [Reflect=for] attribute DOMString htmlFor; + [Reflect] attribute DOMString event; + [Reflect] attribute DOMString charset; + attribute boolean async; + [Reflect] attribute boolean defer; + [Reflect, URL] attribute DOMString src; + [Reflect] attribute DOMString type; + [Reflect] attribute DOMString crossOrigin; + [Reflect, Conditional=CSP_NEXT] attribute DOMString nonce; +}; diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp index 914b55de8..936b1d146 100644 --- a/Source/WebCore/html/HTMLSelectElement.cpp +++ b/Source/WebCore/html/HTMLSelectElement.cpp @@ -106,7 +106,7 @@ void HTMLSelectElement::optionSelectedByUser(int optionIndex, bool fireOnChangeN // User interaction such as mousedown events can cause list box select elements to send change events. // This produces that same behavior for changes triggered by other code running on behalf of the user. if (!usesMenuList()) { - updateSelectedState(optionIndex, allowMultipleSelection, false); + updateSelectedState(optionToListIndex(optionIndex), allowMultipleSelection, false); setNeedsValidityCheck(); if (fireOnChangeNow) listBoxOnChange(); @@ -1289,7 +1289,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) // Convert to coords relative to the list box if needed. MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); - IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); + IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms | SnapOffsetForTransforms)); int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toSize(localOffset)); if (listIndex >= 0) { if (!disabled()) { @@ -1309,7 +1309,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) if (mouseEvent->button() != LeftButton || !mouseEvent->buttonDown()) return; - IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); + IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms | SnapOffsetForTransforms)); int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toSize(localOffset)); if (listIndex >= 0) { if (!disabled()) { @@ -1514,8 +1514,10 @@ void HTMLSelectElement::typeAheadFind(KeyboardEvent* event) return; int selected = selectedIndex(); - int index = (optionToListIndex(selected >= 0 ? selected : 0) + searchStartOffset) % itemCount; - ASSERT(index >= 0); + int index = optionToListIndex(selected >= 0 ? selected : 0) + searchStartOffset; + if (index < 0) + return; + index %= itemCount; // Compute a case-folded copy of the prefix string before beginning the search for // a matching element. This code uses foldCase to work around the fact that diff --git a/Source/WebCore/html/HTMLSelectElement.idl b/Source/WebCore/html/HTMLSelectElement.idl index 6a1ae03d1..ac7f98904 100644 --- a/Source/WebCore/html/HTMLSelectElement.idl +++ b/Source/WebCore/html/HTMLSelectElement.idl @@ -18,51 +18,48 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + IndexedGetter, + CustomIndexedSetter +] interface HTMLSelectElement : HTMLElement { + attribute [Reflect] boolean autofocus; + attribute [Reflect] boolean disabled; + readonly attribute HTMLFormElement form; + attribute boolean multiple; + attribute [Reflect] DOMString name; + attribute [Reflect] boolean required; + attribute long size; - interface [ - IndexedGetter, - CustomIndexedSetter - ] HTMLSelectElement : HTMLElement { - attribute [Reflect] boolean autofocus; - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute boolean multiple; - attribute [Reflect] DOMString name; - attribute [Reflect] boolean required; - attribute long size; + readonly attribute DOMString type; - readonly attribute DOMString type; - - readonly attribute HTMLOptionsCollection options; + readonly attribute HTMLOptionsCollection options; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - // DOM Level 2 changes type of length attribute to unsigned long, - // for compatibility we keep DOM Level 1 definition. - readonly attribute long length; + // DOM Level 2 changes type of length attribute to unsigned long, + // for compatibility we keep DOM Level 1 definition. + readonly attribute long length; #else - attribute unsigned long length setter raises (DOMException); + attribute unsigned long length setter raises (DOMException); #endif - Node item(in [IsIndex,Optional=DefaultIsUndefined] unsigned long index); - Node namedItem(in [Optional=DefaultIsUndefined] DOMString name); - [ObjCLegacyUnnamedParameters] void add(in [Optional=DefaultIsUndefined] HTMLElement element, - in [Optional=DefaultIsUndefined] HTMLElement before) raises(DOMException); + Node item(in [IsIndex,Optional=DefaultIsUndefined] unsigned long index); + Node namedItem(in [Optional=DefaultIsUndefined] DOMString name); + [ObjCLegacyUnnamedParameters] void add(in [Optional=DefaultIsUndefined] HTMLElement element, + in [Optional=DefaultIsUndefined] HTMLElement before) raises(DOMException); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - // In JavaScript, we support both option index and option object parameters. - // As of this writing this cannot be auto-generated. - [Custom] void remove(/* indexOrOption */); + // In JavaScript, we support both option index and option object parameters. + // As of this writing this cannot be auto-generated. + [Custom] void remove(/* indexOrOption */); #else - void remove(in long index); + void remove(in long index); #endif - readonly attribute HTMLCollection selectedOptions; - attribute long selectedIndex; - attribute [TreatNullAs=NullString] DOMString value; + readonly attribute HTMLCollection selectedOptions; + attribute long selectedIndex; + [TreatNullAs=NullString] attribute DOMString value; - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - readonly attribute NodeList labels; - }; -} + readonly attribute NodeList labels; +}; diff --git a/Source/WebCore/html/HTMLSourceElement.idl b/Source/WebCore/html/HTMLSourceElement.idl index dc707140a..d7880e45d 100644 --- a/Source/WebCore/html/HTMLSourceElement.idl +++ b/Source/WebCore/html/HTMLSourceElement.idl @@ -23,12 +23,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=VIDEO, - ] HTMLSourceElement : HTMLElement { - attribute [Reflect, URL] DOMString src; - attribute DOMString type; - attribute DOMString media; +[ + Conditional=VIDEO, +] interface HTMLSourceElement : HTMLElement { +attribute [Reflect, URL] DOMString src; +attribute DOMString type; +attribute DOMString media; }; -} diff --git a/Source/WebCore/html/HTMLSpanElement.idl b/Source/WebCore/html/HTMLSpanElement.idl index d6d4e59eb..e47cfd797 100644 --- a/Source/WebCore/html/HTMLSpanElement.idl +++ b/Source/WebCore/html/HTMLSpanElement.idl @@ -23,10 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +// http://www.whatwg.org/specs/web-apps/current-work/#htmlspanelement +interface HTMLSpanElement : HTMLElement { +}; - // http://www.whatwg.org/specs/web-apps/current-work/#htmlspanelement - interface HTMLSpanElement : HTMLElement { - }; - -} diff --git a/Source/WebCore/html/HTMLStyleElement.cpp b/Source/WebCore/html/HTMLStyleElement.cpp index 9bfc91a43..228c392df 100644 --- a/Source/WebCore/html/HTMLStyleElement.cpp +++ b/Source/WebCore/html/HTMLStyleElement.cpp @@ -30,6 +30,7 @@ #include "Event.h" #include "EventSender.h" #include "HTMLNames.h" +#include "MediaList.h" #include "ScriptEventListener.h" #include "ScriptableDocumentParser.h" #include "ShadowRoot.h" @@ -50,9 +51,7 @@ inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document , StyleElement(document, createdByParser) , m_firedLoad(false) , m_loadedSheet(false) -#if ENABLE(STYLE_SCOPED) , m_scopedStyleRegistrationState(NotRegistered) -#endif { ASSERT(hasTagName(styleTag)); } @@ -79,17 +78,19 @@ void HTMLStyleElement::parseAttribute(const Attribute& attribute) setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute)); else if (attribute.name() == onerrorAttr) setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute)); -#if ENABLE(STYLE_SCOPED) - else if (attribute.name() == scopedAttr) + else if (attribute.name() == scopedAttr && ContextFeatures::styleScopedEnabled(document())) scopedAttributeChanged(!attribute.isNull()); -#endif - else + else if (attribute.name() == mediaAttr && inDocument() && document()->renderer() && m_sheet) { + m_sheet->setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(attribute.value())); + document()->styleResolverChanged(RecalcStyleImmediately); + } else HTMLElement::parseAttribute(attribute); } -#if ENABLE(STYLE_SCOPED) void HTMLStyleElement::scopedAttributeChanged(bool scoped) { + ASSERT(ContextFeatures::styleScopedEnabled(document())); + if (!inDocument()) return; @@ -114,7 +115,6 @@ void HTMLStyleElement::scopedAttributeChanged(bool scoped) if (isInShadowTree() && m_scopedStyleRegistrationState != RegisteredInShadowRoot) registerWithScopingNode(false); } -#endif void HTMLStyleElement::finishParsingChildren() { @@ -122,15 +122,12 @@ void HTMLStyleElement::finishParsingChildren() HTMLElement::finishParsingChildren(); } -#if ENABLE(STYLE_SCOPED) inline bool HTMLStyleElement::isRegisteredAsScoped() const { // Note: We cannot rely on the 'scoped' attribute still being present when this method is invoked. // Therefore we cannot rely on scoped()! if (m_scopedStyleRegistrationState == NotRegistered) return false; - if (!ContextFeatures::styleScopedEnabled(document())) - return false; return true; } @@ -167,8 +164,6 @@ void HTMLStyleElement::registerWithScopingNode(bool scoped) ASSERT(inDocument()); if (m_scopedStyleRegistrationState != NotRegistered) return; - if (!ContextFeatures::styleScopedEnabled(document())) - return; ContainerNode* scope = scoped ? parentNode() : shadowRoot(); if (!scope) @@ -205,22 +200,14 @@ void HTMLStyleElement::unregisterWithScopingNode(ContainerNode* scope) m_scopedStyleRegistrationState = NotRegistered; } -#else -size_t Node::numberOfScopedHTMLStyleChildren() const -{ - return 0; -} -#endif Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(ContainerNode* insertionPoint) { HTMLElement::insertedInto(insertionPoint); if (insertionPoint->inDocument()) { StyleElement::insertedIntoDocument(document(), this); -#if ENABLE(STYLE_SCOPED) if (m_scopedStyleRegistrationState == NotRegistered && (scoped() || isInShadowTree())) registerWithScopingNode(scoped()); -#endif } return InsertionDone; @@ -230,7 +217,6 @@ void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) { HTMLElement::removedFrom(insertionPoint); -#if ENABLE(STYLE_SCOPED) // In the current implementation, <style scoped> is only registered if the node is in the document. // That is, because willRemove() is also called if an ancestor is removed from the document. // Now, if we want to register <style scoped> even if it's not inDocument, @@ -245,7 +231,6 @@ void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) scope = parentNode() ? parentNode() : insertionPoint; unregisterWithScopingNode(scope); } -#endif if (insertionPoint->inDocument()) StyleElement::removedFromDocument(document(), this); @@ -267,10 +252,9 @@ const AtomicString& HTMLStyleElement::type() const return getAttribute(typeAttr); } -#if ENABLE(STYLE_SCOPED) bool HTMLStyleElement::scoped() const { - return fastHasAttribute(scopedAttr); + return fastHasAttribute(scopedAttr) && ContextFeatures::styleScopedEnabled(document()); } void HTMLStyleElement::setScoped(bool scopedValue) @@ -292,7 +276,6 @@ Element* HTMLStyleElement::scopingElement() const return toElement(parentOrHost); } -#endif // ENABLE(STYLE_SCOPED) void HTMLStyleElement::dispatchPendingLoadEvents() { diff --git a/Source/WebCore/html/HTMLStyleElement.h b/Source/WebCore/html/HTMLStyleElement.h index 8476c648f..76b28d4cf 100644 --- a/Source/WebCore/html/HTMLStyleElement.h +++ b/Source/WebCore/html/HTMLStyleElement.h @@ -41,12 +41,10 @@ public: void setType(const AtomicString&); -#if ENABLE(STYLE_SCOPED) bool scoped() const; void setScoped(bool); Element* scopingElement() const; bool isRegisteredAsScoped() const; -#endif using StyleElement::sheet; @@ -77,23 +75,19 @@ private: virtual const AtomicString& media() const; virtual const AtomicString& type() const; -#if ENABLE(STYLE_SCOPED) void scopedAttributeChanged(bool); void registerWithScopingNode(bool); void unregisterWithScopingNode(ContainerNode*); -#endif bool m_firedLoad; bool m_loadedSheet; -#if ENABLE(STYLE_SCOPED) enum ScopedStyleRegistrationState { NotRegistered, RegisteredAsScoped, RegisteredInShadowRoot }; ScopedStyleRegistrationState m_scopedStyleRegistrationState; -#endif }; } //namespace diff --git a/Source/WebCore/html/HTMLStyleElement.idl b/Source/WebCore/html/HTMLStyleElement.idl index 1b9abd47a..a14165d4e 100644 --- a/Source/WebCore/html/HTMLStyleElement.idl +++ b/Source/WebCore/html/HTMLStyleElement.idl @@ -18,16 +18,13 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLStyleElement : HTMLElement { + attribute boolean disabled; + [Conditional=STYLE_SCOPED, V8EnabledAtRuntime=styleScoped] attribute boolean scoped; + [Reflect] attribute DOMString media; + [Reflect] attribute DOMString type; - interface HTMLStyleElement : HTMLElement { - attribute boolean disabled; - attribute [Conditional=STYLE_SCOPED, V8EnabledAtRuntime=styleScoped] boolean scoped; - attribute [Reflect] DOMString media; - attribute [Reflect] DOMString type; + // DOM Level 2 Style + readonly attribute StyleSheet sheet; +}; - // DOM Level 2 Style - readonly attribute StyleSheet sheet; - }; - -} diff --git a/Source/WebCore/html/HTMLTableCaptionElement.idl b/Source/WebCore/html/HTMLTableCaptionElement.idl index 075953978..d9b3aa548 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.idl +++ b/Source/WebCore/html/HTMLTableCaptionElement.idl @@ -18,12 +18,9 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + JSGenerateToNativeObject +] interface HTMLTableCaptionElement : HTMLElement { + [Reflect] attribute DOMString align; +}; - interface [ - JSGenerateToNativeObject - ] HTMLTableCaptionElement : HTMLElement { - attribute [Reflect] DOMString align; - }; - -} diff --git a/Source/WebCore/html/HTMLTableCellElement.idl b/Source/WebCore/html/HTMLTableCellElement.idl index ae286f4d6..3b949f390 100644 --- a/Source/WebCore/html/HTMLTableCellElement.idl +++ b/Source/WebCore/html/HTMLTableCellElement.idl @@ -18,24 +18,21 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLTableCellElement : HTMLElement { + readonly attribute long cellIndex; + [Reflect] attribute DOMString abbr; + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString axis; + [Reflect] attribute DOMString bgColor; + [Reflect=char] attribute DOMString ch; + [Reflect=charoff] attribute DOMString chOff; + attribute long colSpan; + [Reflect] attribute DOMString headers; + [Reflect] attribute DOMString height; + [Reflect] attribute boolean noWrap; + attribute long rowSpan; + [Reflect] attribute DOMString scope; + [Reflect] attribute DOMString vAlign; + [Reflect] attribute DOMString width; +}; - interface HTMLTableCellElement : HTMLElement { - readonly attribute long cellIndex; - attribute [Reflect] DOMString abbr; - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString axis; - attribute [Reflect] DOMString bgColor; - attribute [Reflect=char] DOMString ch; - attribute [Reflect=charoff] DOMString chOff; - attribute long colSpan; - attribute [Reflect] DOMString headers; - attribute [Reflect] DOMString height; - attribute [Reflect] boolean noWrap; - attribute long rowSpan; - attribute [Reflect] DOMString scope; - attribute [Reflect] DOMString vAlign; - attribute [Reflect] DOMString width; - }; - -} diff --git a/Source/WebCore/html/HTMLTableColElement.idl b/Source/WebCore/html/HTMLTableColElement.idl index a6e665401..725e05dec 100644 --- a/Source/WebCore/html/HTMLTableColElement.idl +++ b/Source/WebCore/html/HTMLTableColElement.idl @@ -18,15 +18,12 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLTableColElement : HTMLElement { + [Reflect] attribute DOMString align; + [Reflect=char] attribute DOMString ch; + [Reflect=charoff] attribute DOMString chOff; + attribute long span; + [Reflect] attribute DOMString vAlign; + [Reflect] attribute DOMString width; +}; - interface HTMLTableColElement : HTMLElement { - attribute [Reflect] DOMString align; - attribute [Reflect=char] DOMString ch; - attribute [Reflect=charoff] DOMString chOff; - attribute long span; - attribute [Reflect] DOMString vAlign; - attribute [Reflect] DOMString width; - }; - -} diff --git a/Source/WebCore/html/HTMLTableElement.idl b/Source/WebCore/html/HTMLTableElement.idl index 190861a7f..470af5658 100644 --- a/Source/WebCore/html/HTMLTableElement.idl +++ b/Source/WebCore/html/HTMLTableElement.idl @@ -18,37 +18,34 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLTableElement : HTMLElement { + attribute HTMLTableCaptionElement caption setter raises(DOMException); + attribute HTMLTableSectionElement tHead setter raises(DOMException); + attribute HTMLTableSectionElement tFoot setter raises(DOMException); + + readonly attribute HTMLCollection rows; + readonly attribute HTMLCollection tBodies; + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString bgColor; + [Reflect] attribute DOMString border; + [Reflect] attribute DOMString cellPadding; + [Reflect] attribute DOMString cellSpacing; + + [Reflect] attribute DOMString frame; + + [Reflect] attribute DOMString rules; + [Reflect] attribute DOMString summary; + [Reflect] attribute DOMString width; + + HTMLElement createTHead(); + void deleteTHead(); + HTMLElement createTFoot(); + void deleteTFoot(); + HTMLElement createTBody(); + HTMLElement createCaption(); + void deleteCaption(); + + HTMLElement insertRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); + void deleteRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); +}; - interface HTMLTableElement : HTMLElement { - attribute HTMLTableCaptionElement caption setter raises(DOMException); - attribute HTMLTableSectionElement tHead setter raises(DOMException); - attribute HTMLTableSectionElement tFoot setter raises(DOMException); - - readonly attribute HTMLCollection rows; - readonly attribute HTMLCollection tBodies; - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString bgColor; - attribute [Reflect] DOMString border; - attribute [Reflect] DOMString cellPadding; - attribute [Reflect] DOMString cellSpacing; - - attribute [Reflect] DOMString frame; - - attribute [Reflect] DOMString rules; - attribute [Reflect] DOMString summary; - attribute [Reflect] DOMString width; - - HTMLElement createTHead(); - void deleteTHead(); - HTMLElement createTFoot(); - void deleteTFoot(); - HTMLElement createTBody(); - HTMLElement createCaption(); - void deleteCaption(); - - HTMLElement insertRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); - void deleteRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); - }; - -} diff --git a/Source/WebCore/html/HTMLTableRowElement.idl b/Source/WebCore/html/HTMLTableRowElement.idl index b16d754af..15f054f9c 100644 --- a/Source/WebCore/html/HTMLTableRowElement.idl +++ b/Source/WebCore/html/HTMLTableRowElement.idl @@ -18,19 +18,16 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLTableRowElement : HTMLElement { + readonly attribute long rowIndex; + readonly attribute long sectionRowIndex; + readonly attribute HTMLCollection cells; + [Reflect] attribute DOMString align; + [Reflect] attribute DOMString bgColor; + [Reflect=char] attribute DOMString ch; + [Reflect=charoff] attribute DOMString chOff; + [Reflect] attribute DOMString vAlign; + HTMLElement insertCell(in [Optional=DefaultIsUndefined] long index) raises(DOMException); + void deleteCell(in [Optional=DefaultIsUndefined] long index) raises(DOMException); +}; - interface HTMLTableRowElement : HTMLElement { - readonly attribute long rowIndex; - readonly attribute long sectionRowIndex; - readonly attribute HTMLCollection cells; - attribute [Reflect] DOMString align; - attribute [Reflect] DOMString bgColor; - attribute [Reflect=char] DOMString ch; - attribute [Reflect=charoff] DOMString chOff; - attribute [Reflect] DOMString vAlign; - HTMLElement insertCell(in [Optional=DefaultIsUndefined] long index) raises(DOMException); - void deleteCell(in [Optional=DefaultIsUndefined] long index) raises(DOMException); - }; - -} diff --git a/Source/WebCore/html/HTMLTableSectionElement.idl b/Source/WebCore/html/HTMLTableSectionElement.idl index 88f53369b..d11f429cc 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.idl +++ b/Source/WebCore/html/HTMLTableSectionElement.idl @@ -18,18 +18,15 @@ * Boston, MA 02110-1301, USA. */ -module html { +[ + JSGenerateToNativeObject +] interface HTMLTableSectionElement : HTMLElement { + [Reflect] attribute DOMString align; + [Reflect=char] attribute DOMString ch; + [Reflect=charoff] attribute DOMString chOff; + [Reflect] attribute DOMString vAlign; + readonly attribute HTMLCollection rows; + HTMLElement insertRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); + void deleteRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); +}; - interface [ - JSGenerateToNativeObject - ] HTMLTableSectionElement : HTMLElement { - attribute [Reflect] DOMString align; - attribute [Reflect=char] DOMString ch; - attribute [Reflect=charoff] DOMString chOff; - attribute [Reflect] DOMString vAlign; - readonly attribute HTMLCollection rows; - HTMLElement insertRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); - void deleteRow(in [Optional=DefaultIsUndefined] long index) raises(DOMException); - }; - -} diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index 3660ab948..85a1e61a5 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -31,7 +31,7 @@ code interfaceName=HTMLElement col interfaceName=HTMLTableColElement colgroup interfaceName=HTMLTableColElement command interfaceName=HTMLElement -content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, contextConditional=shadowDOM +content interfaceName=HTMLContentElement, conditional=SHADOW_DOM, runtimeConditional=shadowDOM webkitShadowContent interfaceName=HTMLElement, noConstructor datalist interfaceName=HTMLDataListElement, conditional=DATALIST_ELEMENT dd interfaceName=HTMLElement @@ -97,7 +97,7 @@ ol interfaceName=HTMLOListElement optgroup interfaceName=HTMLOptGroupElement option output constructorNeedsFormElement -shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM, contextConditional=shadowDOM +shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM, runtimeConditional=shadowDOM p interfaceName=HTMLParagraphElement param plaintext interfaceName=HTMLElement diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index a42aa7831..db98ccc9f 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -56,10 +56,15 @@ static const int defaultCols = 20; // On submission, LF characters are converted into CRLF. // This function returns number of characters considering this. -static unsigned computeLengthForSubmission(const String& text) +static inline unsigned computeLengthForSubmission(const String& text, unsigned numberOfLineBreaks) +{ + return numGraphemeClusters(text) + numberOfLineBreaks; +} + +static unsigned numberOfLineBreaks(const String& text) { - unsigned count = numGraphemeClusters(text); unsigned length = text.length(); + unsigned count = 0; for (unsigned i = 0; i < length; i++) { if (text[i] == '\n') count++; @@ -67,6 +72,16 @@ static unsigned computeLengthForSubmission(const String& text) return count; } +static inline unsigned computeLengthForSubmission(const String& text) +{ + return numGraphemeClusters(text) + numberOfLineBreaks(text); +} + +static inline unsigned upperBoundForLengthForSubmission(const String& text, unsigned numberOfLineBreaks) +{ + return text.length() + numberOfLineBreaks; +} + HTMLTextAreaElement::HTMLTextAreaElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) : HTMLTextFormControlElement(tagName, document, form) , m_rows(defaultRows) @@ -280,7 +295,13 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* return; unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength); - unsigned currentLength = computeLengthForSubmission(innerTextValue()); + const String& currentValue = innerTextValue(); + unsigned numberOfLineBreaksInCurrentValue = numberOfLineBreaks(currentValue); + if (upperBoundForLengthForSubmission(currentValue, numberOfLineBreaksInCurrentValue) + + upperBoundForLengthForSubmission(event->text(), numberOfLineBreaks(event->text())) < unsignedMaxLength) + return; + + unsigned currentLength = computeLengthForSubmission(currentValue, numberOfLineBreaksInCurrentValue); // selectionLength represents the selection length of this text field to be // removed by this insertion. // If the text field has no focus, we don't need to take account of the @@ -466,7 +487,10 @@ bool HTMLTextAreaElement::tooLong(const String& value, NeedsToCheckDirtyFlag che int max = maxLength(); if (max < 0) return false; - return computeLengthForSubmission(value) > static_cast<unsigned>(max); + unsigned unsignedMax = static_cast<unsigned>(max); + unsigned numberOfLineBreaksInValue = numberOfLineBreaks(value); + return upperBoundForLengthForSubmission(value, numberOfLineBreaksInValue) > unsignedMax + && computeLengthForSubmission(value, numberOfLineBreaksInValue) > unsignedMax; } bool HTMLTextAreaElement::isValidValue(const String& candidate) const diff --git a/Source/WebCore/html/HTMLTextAreaElement.idl b/Source/WebCore/html/HTMLTextAreaElement.idl index 729e6dae6..df8867ace 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.idl +++ b/Source/WebCore/html/HTMLTextAreaElement.idl @@ -19,49 +19,46 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLTextAreaElement : HTMLElement { + [Reflect] attribute boolean autofocus; + attribute long cols; + [Reflect] attribute DOMString dirName; + [Reflect] attribute boolean disabled; + readonly attribute HTMLFormElement form; + attribute long maxLength setter raises(DOMException); + [Reflect] attribute DOMString name; + [Reflect] attribute DOMString placeholder; + [Reflect] attribute boolean readOnly; + [Reflect] attribute boolean required; + attribute long rows; + [Reflect] attribute DOMString wrap; - interface HTMLTextAreaElement : HTMLElement { - attribute [Reflect] boolean autofocus; - attribute long cols; - attribute [Reflect] DOMString dirName; - attribute [Reflect] boolean disabled; - readonly attribute HTMLFormElement form; - attribute long maxLength setter raises(DOMException); - attribute [Reflect] DOMString name; - attribute [Reflect] DOMString placeholder; - attribute [Reflect] boolean readOnly; - attribute [Reflect] boolean required; - attribute long rows; - attribute [Reflect] DOMString wrap; + readonly attribute DOMString type; + [TreatNullAs=NullString] attribute DOMString defaultValue; + [TreatNullAs=NullString] attribute DOMString value; + readonly attribute unsigned long textLength; - readonly attribute DOMString type; - attribute [TreatNullAs=NullString] DOMString defaultValue; - attribute [TreatNullAs=NullString] DOMString value; - readonly attribute unsigned long textLength; + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); - readonly attribute boolean willValidate; - readonly attribute ValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); + readonly attribute NodeList labels; - readonly attribute NodeList labels; - - void select(); - attribute long selectionStart; - attribute long selectionEnd; - attribute DOMString selectionDirection; + void select(); + attribute long selectionStart; + attribute long selectionEnd; + attribute DOMString selectionDirection; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - void setSelectionRange(in long start, in long end); + void setSelectionRange(in long start, in long end); #else - void setSelectionRange(in [Optional=DefaultIsUndefined] long start, - in [Optional=DefaultIsUndefined] long end, - in [Optional] DOMString direction); + void setSelectionRange(in [Optional=DefaultIsUndefined] long start, + in [Optional=DefaultIsUndefined] long end, + in [Optional] DOMString direction); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [Reflect] DOMString accessKey; + [Reflect] attribute DOMString accessKey; #endif - }; -} +}; diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp index 70c06191e..fcde35ae6 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.cpp +++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp @@ -159,9 +159,7 @@ void HTMLTextFormControlElement::updatePlaceholderVisibility(bool placeholderVal HTMLElement* placeholder = placeholderElement(); if (!placeholder) return; - ExceptionCode ec = 0; - placeholder->setInlineStyleProperty(CSSPropertyVisibility, placeholderShouldBeVisible() ? "visible" : "hidden", ec); - ASSERT(!ec); + placeholder->setInlineStyleProperty(CSSPropertyVisibility, placeholderShouldBeVisible() ? "visible" : "hidden"); } void HTMLTextFormControlElement::fixPlaceholderRenderer(HTMLElement* placeholder, HTMLElement* siblingElement) diff --git a/Source/WebCore/html/HTMLTitleElement.idl b/Source/WebCore/html/HTMLTitleElement.idl index e691f7b13..f5639fe17 100644 --- a/Source/WebCore/html/HTMLTitleElement.idl +++ b/Source/WebCore/html/HTMLTitleElement.idl @@ -17,10 +17,7 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLTitleElement : HTMLElement { + [TreatNullAs=NullString] attribute DOMString text; +}; - interface HTMLTitleElement : HTMLElement { - attribute [TreatNullAs=NullString] DOMString text; - }; - -} diff --git a/Source/WebCore/html/HTMLTrackElement.idl b/Source/WebCore/html/HTMLTrackElement.idl index 3e98fed66..07b781bba 100644 --- a/Source/WebCore/html/HTMLTrackElement.idl +++ b/Source/WebCore/html/HTMLTrackElement.idl @@ -23,24 +23,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=VIDEO_TRACK, - V8EnabledAtRuntime=webkitVideoTrack - ] HTMLTrackElement : HTMLElement { - attribute DOMString kind; - attribute [Reflect, URL] DOMString src; - attribute DOMString srclang; - attribute DOMString label; - attribute [Reflect] boolean default; +[ + Conditional=VIDEO_TRACK, + V8EnabledAtRuntime=webkitVideoTrack +] interface HTMLTrackElement : HTMLElement { + attribute DOMString kind; + [Reflect, URL] attribute DOMString src; + attribute DOMString srclang; + attribute DOMString label; + [Reflect] attribute boolean default; - const unsigned short NONE = 0; - const unsigned short LOADING = 1; - const unsigned short LOADED = 2; - // Reflect is used for ERROR because it conflicts with a windows define. - [Reflect=TRACK_ERROR] const unsigned short ERROR = 3; - readonly attribute unsigned short readyState; + const unsigned short NONE = 0; + const unsigned short LOADING = 1; + const unsigned short LOADED = 2; + // Reflect is used for ERROR because it conflicts with a windows define. + [Reflect=TRACK_ERROR] const unsigned short ERROR = 3; + readonly attribute unsigned short readyState; - readonly attribute TextTrack track; + readonly attribute TextTrack track; }; -} diff --git a/Source/WebCore/html/HTMLUListElement.idl b/Source/WebCore/html/HTMLUListElement.idl index 221dcca58..e40350d83 100644 --- a/Source/WebCore/html/HTMLUListElement.idl +++ b/Source/WebCore/html/HTMLUListElement.idl @@ -17,11 +17,8 @@ * Boston, MA 02110-1301, USA. */ -module html { +interface HTMLUListElement : HTMLElement { + [Reflect] attribute boolean compact; + [Reflect] attribute DOMString type; +}; - interface HTMLUListElement : HTMLElement { - attribute [Reflect] boolean compact; - attribute [Reflect] DOMString type; - }; - -} diff --git a/Source/WebCore/html/HTMLUnknownElement.idl b/Source/WebCore/html/HTMLUnknownElement.idl index 9e4f90afa..fe1ca9eda 100644 --- a/Source/WebCore/html/HTMLUnknownElement.idl +++ b/Source/WebCore/html/HTMLUnknownElement.idl @@ -27,9 +27,6 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +interface HTMLUnknownElement : HTMLElement { +}; - interface HTMLUnknownElement : HTMLElement { - }; - -} diff --git a/Source/WebCore/html/HTMLVideoElement.idl b/Source/WebCore/html/HTMLVideoElement.idl index 97a17796e..dba44083b 100644 --- a/Source/WebCore/html/HTMLVideoElement.idl +++ b/Source/WebCore/html/HTMLVideoElement.idl @@ -23,33 +23,31 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=VIDEO, - JSGenerateToNativeObject - ] HTMLVideoElement : HTMLMediaElement { - attribute [Reflect] unsigned long width; - attribute [Reflect] unsigned long height; - readonly attribute unsigned long videoWidth; - readonly attribute unsigned long videoHeight; - attribute [Reflect, URL] DOMString poster; +[ + Conditional=VIDEO, + JSGenerateToNativeObject +] interface HTMLVideoElement : HTMLMediaElement { + [Reflect] attribute unsigned long width; + [Reflect] attribute unsigned long height; + readonly attribute unsigned long videoWidth; + readonly attribute unsigned long videoHeight; + [Reflect, URL] attribute DOMString poster; - readonly attribute boolean webkitSupportsFullscreen; - readonly attribute boolean webkitDisplayingFullscreen; + readonly attribute boolean webkitSupportsFullscreen; + readonly attribute boolean webkitDisplayingFullscreen; - void webkitEnterFullscreen() raises (DOMException); - void webkitExitFullscreen(); + void webkitEnterFullscreen() raises (DOMException); + void webkitExitFullscreen(); - // Note the different capitalization of the "S" in FullScreen. - void webkitEnterFullScreen() raises (DOMException); - void webkitExitFullScreen(); + // Note the different capitalization of the "S" in FullScreen. + void webkitEnterFullScreen() raises (DOMException); + void webkitExitFullScreen(); - // The number of frames that have been decoded and made available for - // playback. - readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitDecodedFrameCount; + // The number of frames that have been decoded and made available for + // playback. + [Conditional=MEDIA_STATISTICS] readonly attribute unsigned long webkitDecodedFrameCount; - // The number of decoded frames that have been dropped by the player - // for performance reasons during playback. - readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitDroppedFrameCount; - }; -} + // The number of decoded frames that have been dropped by the player + // for performance reasons during playback. + [Conditional=MEDIA_STATISTICS] readonly attribute unsigned long webkitDroppedFrameCount; +}; diff --git a/Source/WebCore/html/ImageData.idl b/Source/WebCore/html/ImageData.idl index f2ea0ca6b..ca3195f3b 100644 --- a/Source/WebCore/html/ImageData.idl +++ b/Source/WebCore/html/ImageData.idl @@ -26,16 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - - interface [ - CustomToJSObject - ] ImageData { - readonly attribute long width; - readonly attribute long height; +[ + CustomToJSObject +] interface ImageData { + readonly attribute long width; + readonly attribute long height; #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - readonly attribute Uint8ClampedArray data; + readonly attribute Uint8ClampedArray data; #endif - }; +}; -} diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp index 0afd276c1..5fc9268fb 100644 --- a/Source/WebCore/html/ImageDocument.cpp +++ b/Source/WebCore/html/ImageDocument.cpp @@ -40,6 +40,7 @@ #include "NotImplemented.h" #include "Page.h" #include "RawDataDocumentParser.h" +#include "ResourceBuffer.h" #include "Settings.h" using std::min; @@ -141,7 +142,7 @@ void ImageDocumentParser::finish() { if (!isStopped() && document()->imageElement()) { CachedImage* cachedImage = document()->cachedImage(); - RefPtr<SharedBuffer> data = document()->frame()->loader()->documentLoader()->mainResourceData(); + RefPtr<ResourceBuffer> data = document()->frame()->loader()->documentLoader()->mainResourceData(); // If this is a multipart image, make a copy of the current part, since the resource data // will be overwritten by the next part. diff --git a/Source/WebCore/html/MediaController.idl b/Source/WebCore/html/MediaController.idl index d3f33485b..31443a1db 100644 --- a/Source/WebCore/html/MediaController.idl +++ b/Source/WebCore/html/MediaController.idl @@ -23,41 +23,39 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=VIDEO, - Constructor, - CallWith=ScriptExecutionContext, - JSGenerateToJSObject, - EventTarget - ] MediaController { - readonly attribute TimeRanges buffered; - readonly attribute TimeRanges seekable; +[ + Conditional=VIDEO, + Constructor, + CallWith=ScriptExecutionContext, + JSGenerateToJSObject, + EventTarget +] interface MediaController { + readonly attribute TimeRanges buffered; + readonly attribute TimeRanges seekable; - readonly attribute double duration; - attribute double currentTime - setter raises (DOMException); + readonly attribute double duration; + attribute double currentTime + setter raises (DOMException); - readonly attribute boolean paused; - readonly attribute TimeRanges played; - void play(); - void pause(); + readonly attribute boolean paused; + readonly attribute TimeRanges played; + void play(); + void pause(); - attribute double defaultPlaybackRate; - attribute double playbackRate; + attribute double defaultPlaybackRate; + attribute double playbackRate; - attribute double volume - setter raises (DOMException); - attribute boolean muted; + attribute double volume + setter raises (DOMException); + attribute boolean muted; - // EventTarget interface - void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - void removeEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) - raises(EventException); - }; -} + // EventTarget interface + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); +}; diff --git a/Source/WebCore/html/MediaError.idl b/Source/WebCore/html/MediaError.idl index 8eb9d5402..95e7c84ce 100644 --- a/Source/WebCore/html/MediaError.idl +++ b/Source/WebCore/html/MediaError.idl @@ -23,17 +23,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=VIDEO - ] MediaError { - const unsigned short MEDIA_ERR_ABORTED = 1; - const unsigned short MEDIA_ERR_NETWORK = 2; - const unsigned short MEDIA_ERR_DECODE = 3; - const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; +[ + Conditional=VIDEO +] interface MediaError { + const unsigned short MEDIA_ERR_ABORTED = 1; + const unsigned short MEDIA_ERR_NETWORK = 2; + const unsigned short MEDIA_ERR_DECODE = 3; + const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; #if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA - const unsigned short MEDIA_ERR_ENCRYPTED = 5; + const unsigned short MEDIA_ERR_ENCRYPTED = 5; #endif - readonly attribute unsigned short code; - }; -} + readonly attribute unsigned short code; +}; diff --git a/Source/WebCore/html/MediaKeyError.idl b/Source/WebCore/html/MediaKeyError.idl index 55b9b04d0..5877d5255 100644 --- a/Source/WebCore/html/MediaKeyError.idl +++ b/Source/WebCore/html/MediaKeyError.idl @@ -23,17 +23,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=ENCRYPTED_MEDIA, - V8EnabledAtRuntime=encryptedMedia, - ] MediaKeyError { - const unsigned short MEDIA_KEYERR_UNKNOWN = 1; - const unsigned short MEDIA_KEYERR_CLIENT = 2; - const unsigned short MEDIA_KEYERR_SERVICE = 3; - const unsigned short MEDIA_KEYERR_OUTPUT = 4; - const unsigned short MEDIA_KEYERR_HARDWARECHANGE = 5; - const unsigned short MEDIA_KEYERR_DOMAIN = 6; - readonly attribute unsigned short code; - }; -} +[ + Conditional=ENCRYPTED_MEDIA, + V8EnabledAtRuntime=encryptedMedia, +] interface MediaKeyError { + const unsigned short MEDIA_KEYERR_UNKNOWN = 1; + const unsigned short MEDIA_KEYERR_CLIENT = 2; + const unsigned short MEDIA_KEYERR_SERVICE = 3; + const unsigned short MEDIA_KEYERR_OUTPUT = 4; + const unsigned short MEDIA_KEYERR_HARDWARECHANGE = 5; + const unsigned short MEDIA_KEYERR_DOMAIN = 6; + readonly attribute unsigned short code; +}; diff --git a/Source/WebCore/html/MediaKeyEvent.idl b/Source/WebCore/html/MediaKeyEvent.idl index b1387dcfc..f4d0d8605 100644 --- a/Source/WebCore/html/MediaKeyEvent.idl +++ b/Source/WebCore/html/MediaKeyEvent.idl @@ -23,20 +23,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=ENCRYPTED_MEDIA, + V8EnabledAtRuntime=encryptedMedia, + ConstructorTemplate=Event +] interface MediaKeyEvent : Event { + [InitializedByEventConstructor] readonly attribute DOMString keySystem; + [InitializedByEventConstructor] readonly attribute DOMString sessionId; + [InitializedByEventConstructor] readonly attribute Uint8Array initData; + [InitializedByEventConstructor] readonly attribute Uint8Array message; + [InitializedByEventConstructor] readonly attribute DOMString defaultURL; + [InitializedByEventConstructor] readonly attribute MediaKeyError errorCode; + [InitializedByEventConstructor] readonly attribute unsigned short systemCode; +}; - interface [ - Conditional=ENCRYPTED_MEDIA, - V8EnabledAtRuntime=encryptedMedia, - ConstructorTemplate=Event - ] MediaKeyEvent : Event { - readonly attribute [InitializedByEventConstructor] DOMString keySystem; - readonly attribute [InitializedByEventConstructor] DOMString sessionId; - readonly attribute [InitializedByEventConstructor] Uint8Array initData; - readonly attribute [InitializedByEventConstructor] Uint8Array message; - readonly attribute [InitializedByEventConstructor] DOMString defaultURL; - readonly attribute [InitializedByEventConstructor] MediaKeyError errorCode; - readonly attribute [InitializedByEventConstructor] unsigned short systemCode; - }; - -} diff --git a/Source/WebCore/html/MicroDataItemValue.idl b/Source/WebCore/html/MicroDataItemValue.idl index 5522b4fff..5b29ed542 100644 --- a/Source/WebCore/html/MicroDataItemValue.idl +++ b/Source/WebCore/html/MicroDataItemValue.idl @@ -28,12 +28,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=MICRODATA, - CustomToJSObject, - OmitConstructor - ] MicroDataItemValue { - }; -} - +[ + Conditional=MICRODATA, + CustomToJSObject, + OmitConstructor +] interface MicroDataItemValue { +}; diff --git a/Source/WebCore/html/MonthInputType.cpp b/Source/WebCore/html/MonthInputType.cpp index fc672e3ee..b58743878 100644 --- a/Source/WebCore/html/MonthInputType.cpp +++ b/Source/WebCore/html/MonthInputType.cpp @@ -42,6 +42,13 @@ #if ENABLE(INPUT_TYPE_MONTH) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +#include "DateTimeFieldsState.h" +#include "LocalizedStrings.h" +#include "Localizer.h" +#include <wtf/text/WTFString.h> +#endif + namespace WebCore { using namespace HTMLNames; @@ -137,6 +144,24 @@ bool MonthInputType::isMonthField() const return true; } +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +String MonthInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +{ + if (!dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear()) + return emptyString(); + return String::format("%04u-%02u", dateTimeFieldsState.year(), dateTimeFieldsState.month()); +} + +void MonthInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const +{ + layoutParameters.dateTimeFormat = monthFormatInLDML(); + layoutParameters.fallbackDateTimeFormat = "MM/yyyy"; + layoutParameters.minimumYear = fullYear(element()->fastGetAttribute(minAttr)); + layoutParameters.maximumYear = fullYear(element()->fastGetAttribute(maxAttr)); + layoutParameters.placeholderForMonth = "--"; + layoutParameters.placeholderForYear = "----"; +} +#endif } // namespace WebCore #endif diff --git a/Source/WebCore/html/MonthInputType.h b/Source/WebCore/html/MonthInputType.h index 8f24fa785..3d4f59c6c 100644 --- a/Source/WebCore/html/MonthInputType.h +++ b/Source/WebCore/html/MonthInputType.h @@ -31,18 +31,23 @@ #ifndef MonthInputType_h #define MonthInputType_h -#include "BaseDateAndTimeInputType.h" - #if ENABLE(INPUT_TYPE_MONTH) +#include "BaseMultipleFieldsDateAndTimeInputType.h" namespace WebCore { -class MonthInputType : public BaseDateAndTimeInputType { +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +typedef BaseMultipleFieldsDateAndTimeInputType BaseMonthInputType; +#else +typedef BaseDateAndTimeInputType BaseMonthInputType; +#endif + +class MonthInputType : public BaseMonthInputType { public: static PassOwnPtr<InputType> create(HTMLInputElement*); private: - MonthInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { } + MonthInputType(HTMLInputElement* element) : BaseMonthInputType(element) { } virtual const AtomicString& formControlType() const OVERRIDE; virtual DateComponents::Type dateType() const OVERRIDE; virtual double valueAsDate() const OVERRIDE; @@ -53,6 +58,12 @@ private: virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; virtual bool isMonthField() const OVERRIDE; + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) + // BaseMultipleFieldsDateAndTimeInputType functions + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp index 794545dc9..306bf8fb6 100644 --- a/Source/WebCore/html/NumberInputType.cpp +++ b/Source/WebCore/html/NumberInputType.cpp @@ -39,7 +39,7 @@ #include "HTMLParserIdioms.h" #include "InputTypeNames.h" #include "KeyboardEvent.h" -#include "LocalizedNumber.h" +#include "Localizer.h" #include "RenderTextControl.h" #include <limits> #include <wtf/ASCIICType.h> @@ -235,7 +235,7 @@ String NumberInputType::localizeValue(const String& proposedValue) const // We don't localize scientific notations. if (proposedValue.find(isE) != notFound) return proposedValue; - return convertToLocalizedNumber(proposedValue); + return element()->localizer().convertToLocalizedNumber(proposedValue); } String NumberInputType::visibleValue() const @@ -250,7 +250,7 @@ String NumberInputType::convertFromVisibleValue(const String& visibleValue) cons // We don't localize scientific notations. if (visibleValue.find(isE) != notFound) return visibleValue; - return convertFromLocalizedNumber(visibleValue); + return element()->localizer().convertFromLocalizedNumber(visibleValue); } bool NumberInputType::isAcceptableValue(const String& proposedValue) diff --git a/Source/WebCore/html/RadioNodeList.idl b/Source/WebCore/html/RadioNodeList.idl index 8ed57bacd..7cae4859c 100644 --- a/Source/WebCore/html/RadioNodeList.idl +++ b/Source/WebCore/html/RadioNodeList.idl @@ -23,13 +23,9 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - - interface [ - JSGenerateToJSObject, - IndexedGetter, - ] RadioNodeList : NodeList { - attribute DOMString value; - }; -} - +[ + JSGenerateToJSObject, + IndexedGetter, +] interface RadioNodeList : NodeList { + attribute DOMString value; +}; diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp index 71b955d6f..4c70608e3 100644 --- a/Source/WebCore/html/RangeInputType.cpp +++ b/Source/WebCore/html/RangeInputType.cpp @@ -340,7 +340,8 @@ HTMLElement* RangeInputType::sliderTrackElement() const void RangeInputType::listAttributeTargetChanged() { m_tickMarkValuesDirty = true; - element()->setNeedsStyleRecalc(); + if (element()->renderer()) + element()->renderer()->setNeedsLayout(true); } static bool decimalCompare(const Decimal& a, const Decimal& b) diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp index 692121e5c..3e6c1ee7c 100644 --- a/Source/WebCore/html/TextFieldInputType.cpp +++ b/Source/WebCore/html/TextFieldInputType.cpp @@ -381,6 +381,10 @@ void TextFieldInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* // Truncate the inserted text to avoid violating the maxLength and other constraints. String eventText = event->text(); + unsigned textLength = eventText.length(); + while (textLength > 0 && isASCIILineBreak(eventText[textLength - 1])) + textLength--; + eventText.truncate(textLength); eventText.replace("\r\n", " "); eventText.replace('\r', ' '); eventText.replace('\n', ' '); diff --git a/Source/WebCore/html/TextMetrics.idl b/Source/WebCore/html/TextMetrics.idl index 1a315bac2..eb015a7fe 100644 --- a/Source/WebCore/html/TextMetrics.idl +++ b/Source/WebCore/html/TextMetrics.idl @@ -23,10 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +interface TextMetrics { + readonly attribute float width; +}; - interface TextMetrics { - readonly attribute float width; - }; - -} diff --git a/Source/WebCore/html/TimeInputType.cpp b/Source/WebCore/html/TimeInputType.cpp index a0051513a..789cd3fee 100644 --- a/Source/WebCore/html/TimeInputType.cpp +++ b/Source/WebCore/html/TimeInputType.cpp @@ -41,13 +41,10 @@ #include <wtf/PassOwnPtr.h> #if ENABLE(INPUT_TYPE_TIME) -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldsState.h" -#include "ElementShadow.h" -#include "FormController.h" -#include "KeyboardEvent.h" #include "Localizer.h" -#include "ShadowRoot.h" #include <wtf/text/WTFString.h> #endif @@ -59,6 +56,11 @@ static const int timeDefaultStep = 60; static const int timeDefaultStepBase = 0; static const int timeStepScaleFactor = 1000; +TimeInputType::TimeInputType(HTMLInputElement* element) + : BaseTimeInputType(element) +{ +} + PassOwnPtr<InputType> TimeInputType::create(HTMLInputElement* element) { return adoptPtr(new TimeInputType(element)); @@ -118,47 +120,21 @@ bool TimeInputType::isTimeField() const return true; } -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) - -TimeInputType::DateTimeEditControlOwnerImpl::DateTimeEditControlOwnerImpl(TimeInputType& timeInputType) - : m_timeInputType(timeInputType) -{ -} +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) -TimeInputType::DateTimeEditControlOwnerImpl::~DateTimeEditControlOwnerImpl() +String TimeInputType::localizeValue(const String& proposedValue) const { -} - -void TimeInputType::DateTimeEditControlOwnerImpl::didBlurFromControl() -{ - // We don't need to call blur(). This function is called when control - // lost focus. - - // Remove focus ring by CSS "focus" pseudo class. - m_timeInputType.element()->setFocus(false); -} - -void TimeInputType::DateTimeEditControlOwnerImpl::didFocusOnControl() -{ - // We don't need to call focus(). This function is called when control - // got focus. + DateComponents date; + if (!parseToDateComponents(proposedValue, &date)) + return proposedValue; - // Add focus ring by CSS "focus" pseudo class. - m_timeInputType.element()->setFocus(true); -} + Localizer::FormatType formatType = shouldHaveSecondField(date) ? Localizer::FormatTypeMedium : Localizer::FormatTypeShort; -void TimeInputType::DateTimeEditControlOwnerImpl::editControlValueChanged() -{ - RefPtr<HTMLInputElement> input(m_timeInputType.element()); - input->setValueInternal(m_timeInputType.m_dateTimeEditElement->value(), DispatchNoEvent); - input->setNeedsStyleRecalc(); - input->dispatchFormControlInputEvent(); - input->dispatchFormControlChangeEvent(); - input->notifyFormStateChanged(); + String localized = element()->localizer().formatDateTime(date, formatType); + return localized.isEmpty() ? proposedValue : localized; } - -String TimeInputType::DateTimeEditControlOwnerImpl::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +String TimeInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const { if (!dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM()) return emptyString(); @@ -176,179 +152,15 @@ String TimeInputType::DateTimeEditControlOwnerImpl::formatDateTimeFieldsState(co return String::format("%02u:%02u", dateTimeFieldsState.hour23(), dateTimeFieldsState.minute()); } -bool TimeInputType::hasCustomFocusLogic() const -{ - return false; -} - -bool TimeInputType::DateTimeEditControlOwnerImpl::isEditControlOwnerDisabled() const -{ - return m_timeInputType.element()->readOnly(); -} - -bool TimeInputType::DateTimeEditControlOwnerImpl::isEditControlOwnerReadOnly() const -{ - return m_timeInputType.element()->disabled(); -} - -TimeInputType::TimeInputType(HTMLInputElement* element) - : BaseDateAndTimeInputType(element) - , m_dateTimeEditElement(0) - , m_dateTimeEditControlOwnerImpl(*this) -{ -} - -TimeInputType::~TimeInputType() -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->removeEditControlOwner(); -} - -void TimeInputType::blur() -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->blurByOwner(); -} - -RenderObject* TimeInputType::createRenderer(RenderArena* arena, RenderStyle* style) const -{ - return InputType::createRenderer(arena, style); -} - -void TimeInputType::createShadowSubtree() -{ - ASSERT(element()->shadow()); - - RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(element()->document(), m_dateTimeEditControlOwnerImpl)); - m_dateTimeEditElement = dateTimeEditElement.get(); - element()->userAgentShadowRoot()->appendChild(m_dateTimeEditElement); - updateInnerTextValue(); -} - -void TimeInputType::destroyShadowSubtree() -{ - if (m_dateTimeEditElement) { - m_dateTimeEditElement->removeEditControlOwner(); - m_dateTimeEditElement = 0; - } - BaseDateAndTimeInputType::destroyShadowSubtree(); -} - -void TimeInputType::focus(bool) -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->focusByOwner(); -} - -void TimeInputType::forwardEvent(Event* event) -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->defaultEventHandler(event); -} - -void TimeInputType::disabledAttributeChanged() -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->disabledStateChanged(); -} - -void TimeInputType::handleKeydownEvent(KeyboardEvent* event) -{ - forwardEvent(event); -} - -bool TimeInputType::isKeyboardFocusable(KeyboardEvent*) const -{ - return false; -} - -bool TimeInputType::isMouseFocusable() const -{ - return false; -} - -void TimeInputType::minOrMaxAttributeChanged() -{ - updateInnerTextValue(); -} - -void TimeInputType::readonlyAttributeChanged() -{ - if (m_dateTimeEditElement) - m_dateTimeEditElement->readOnlyStateChanged(); -} - -bool TimeInputType::isTextField() const -{ - return false; -} - -void TimeInputType::restoreFormControlState(const FormControlState& state) +void TimeInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const { - if (!m_dateTimeEditElement) - return; - DateComponents date; - setMillisecondToDateComponents(createStepRange(AnyIsDefaultStep).minimum().toDouble(), &date); - DateTimeFieldsState dateTimeFieldsState = DateTimeFieldsState::restoreFormControlState(state); - m_dateTimeEditElement->setValueAsDateTimeFieldsState(dateTimeFieldsState, date); - element()->setValueInternal(m_dateTimeEditElement->value(), DispatchNoEvent); -} - -FormControlState TimeInputType::saveFormControlState() const -{ - if (!m_dateTimeEditElement) - return FormControlState(); - - return m_dateTimeEditElement->valueAsDateTimeFieldsState().saveFormControlState(); -} - -void TimeInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior) -{ - InputType::setValue(sanitizedValue, valueChanged, eventBehavior); - if (valueChanged) - updateInnerTextValue(); -} - -bool TimeInputType::shouldUseInputMethod() const -{ - return false; -} - -void TimeInputType::stepAttributeChanged() -{ - updateInnerTextValue(); -} - -void TimeInputType::updateInnerTextValue() -{ - if (!m_dateTimeEditElement) - return; - - Localizer& localizer = element()->document()->getLocalizer(element()->computeInheritedLanguage()); - DateTimeEditElement::LayoutParameters layoutParameters(localizer, createStepRange(AnyIsDefaultStep)); - - DateComponents date; - const bool hasValue = parseToDateComponents(element()->value(), &date); - if (!hasValue) - setMillisecondToDateComponents(layoutParameters.stepRange.minimum().toDouble(), &date); - - if (date.second() || layoutParameters.shouldHaveSecondField()) { - layoutParameters.dateTimeFormat = localizer.timeFormat(); + if (shouldHaveSecondField(date)) { + layoutParameters.dateTimeFormat = layoutParameters.localizer.timeFormat(); layoutParameters.fallbackDateTimeFormat = "HH:mm:ss"; } else { - layoutParameters.dateTimeFormat = localizer.shortTimeFormat(); + layoutParameters.dateTimeFormat = layoutParameters.localizer.shortTimeFormat(); layoutParameters.fallbackDateTimeFormat = "HH:mm"; } - - if (hasValue) - m_dateTimeEditElement->setValueAsDate(layoutParameters, date); - else - m_dateTimeEditElement->setEmptyValue(layoutParameters, date); -} -#else -TimeInputType::TimeInputType(HTMLInputElement* element) - : BaseDateAndTimeInputType(element) -{ } #endif diff --git a/Source/WebCore/html/TimeInputType.h b/Source/WebCore/html/TimeInputType.h index 59e272102..dafd58dfb 100644 --- a/Source/WebCore/html/TimeInputType.h +++ b/Source/WebCore/html/TimeInputType.h @@ -31,24 +31,21 @@ #ifndef TimeInputType_h #define TimeInputType_h -#include "BaseDateAndTimeInputType.h" - #if ENABLE(INPUT_TYPE_TIME) - -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) -#include "DateTimeEditElement.h" -#endif +#include "BaseMultipleFieldsDateAndTimeInputType.h" namespace WebCore { -class TimeInputType : public BaseDateAndTimeInputType { +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +typedef BaseMultipleFieldsDateAndTimeInputType BaseTimeInputType; +#else +typedef BaseDateAndTimeInputType BaseTimeInputType; +#endif + +class TimeInputType : public BaseTimeInputType { public: static PassOwnPtr<InputType> create(HTMLInputElement*); -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) - virtual ~TimeInputType(); -#endif - private: TimeInputType(HTMLInputElement*); virtual const AtomicString& formControlType() const OVERRIDE; @@ -58,52 +55,12 @@ private: virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; virtual bool isTimeField() const OVERRIDE; +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) + virtual String localizeValue(const String&) const OVERRIDE; -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) - class DateTimeEditControlOwnerImpl : public DateTimeEditElement::EditControlOwner { - WTF_MAKE_NONCOPYABLE(DateTimeEditControlOwnerImpl); - - public: - DateTimeEditControlOwnerImpl(TimeInputType&); - virtual ~DateTimeEditControlOwnerImpl(); - - private: - virtual void didBlurFromControl() OVERRIDE FINAL; - virtual void didFocusOnControl() OVERRIDE FINAL; - virtual void editControlValueChanged() OVERRIDE FINAL; - virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL; - virtual bool isEditControlOwnerDisabled() const OVERRIDE FINAL; - virtual bool isEditControlOwnerReadOnly() const OVERRIDE FINAL; - - TimeInputType& m_timeInputType; - }; - - friend class DateTimeEditControlOwnerImpl; - - // InputType functions - virtual void blur() OVERRIDE FINAL; - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE FINAL; - virtual void createShadowSubtree() OVERRIDE FINAL; - virtual void destroyShadowSubtree() OVERRIDE FINAL; - virtual void disabledAttributeChanged() OVERRIDE FINAL; - virtual void focus(bool restorePreviousSelection) OVERRIDE FINAL; - virtual void forwardEvent(Event*) OVERRIDE FINAL; - virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE FINAL; - virtual bool hasCustomFocusLogic() const OVERRIDE FINAL; - virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE FINAL; - virtual bool isMouseFocusable() const OVERRIDE FINAL; - virtual bool isTextField() const OVERRIDE FINAL; - virtual void minOrMaxAttributeChanged() OVERRIDE FINAL; - virtual void readonlyAttributeChanged() OVERRIDE FINAL; - virtual void restoreFormControlState(const FormControlState&) OVERRIDE FINAL; - virtual FormControlState saveFormControlState() const OVERRIDE FINAL; - virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE FINAL; - virtual bool shouldUseInputMethod() const OVERRIDE FINAL; - virtual void stepAttributeChanged() OVERRIDE FINAL; - virtual void updateInnerTextValue() OVERRIDE FINAL; - - DateTimeEditElement* m_dateTimeEditElement; - DateTimeEditControlOwnerImpl m_dateTimeEditControlOwnerImpl; + // BaseMultipleFieldsDateAndTimeInputType functions + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL; #endif }; diff --git a/Source/WebCore/html/TimeRanges.idl b/Source/WebCore/html/TimeRanges.idl index c37c360db..97cd46194 100644 --- a/Source/WebCore/html/TimeRanges.idl +++ b/Source/WebCore/html/TimeRanges.idl @@ -23,16 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=VIDEO +] interface TimeRanges { + readonly attribute unsigned long length; + float start(in unsigned long index) + raises (DOMException); + float end(in unsigned long index) + raises (DOMException); +}; - interface [ - Conditional=VIDEO - ] TimeRanges { - readonly attribute unsigned long length; - float start(in unsigned long index) - raises (DOMException); - float end(in unsigned long index) - raises (DOMException); - }; - -} diff --git a/Source/WebCore/html/ValidityState.idl b/Source/WebCore/html/ValidityState.idl index 601bfafed..dae343b9a 100644 --- a/Source/WebCore/html/ValidityState.idl +++ b/Source/WebCore/html/ValidityState.idl @@ -20,19 +20,16 @@ * */ -module html { - - interface [ - OmitConstructor - ] ValidityState { - readonly attribute boolean valueMissing; - readonly attribute boolean typeMismatch; - readonly attribute boolean patternMismatch; - readonly attribute boolean tooLong; - readonly attribute boolean rangeUnderflow; - readonly attribute boolean rangeOverflow; - readonly attribute boolean stepMismatch; - readonly attribute boolean customError; - readonly attribute boolean valid; - }; -} +[ + OmitConstructor +] interface ValidityState { + readonly attribute boolean valueMissing; + readonly attribute boolean typeMismatch; + readonly attribute boolean patternMismatch; + readonly attribute boolean tooLong; + readonly attribute boolean rangeUnderflow; + readonly attribute boolean rangeOverflow; + readonly attribute boolean stepMismatch; + readonly attribute boolean customError; + readonly attribute boolean valid; +}; diff --git a/Source/WebCore/html/VoidCallback.idl b/Source/WebCore/html/VoidCallback.idl index f1b0779e4..31a221510 100644 --- a/Source/WebCore/html/VoidCallback.idl +++ b/Source/WebCore/html/VoidCallback.idl @@ -23,10 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Callback - ] VoidCallback { - boolean handleEvent(); - }; -} +[ + Callback +] interface VoidCallback { + boolean handleEvent(); +}; diff --git a/Source/WebCore/html/WeekInputType.cpp b/Source/WebCore/html/WeekInputType.cpp index adbb87591..b16ac2856 100644 --- a/Source/WebCore/html/WeekInputType.cpp +++ b/Source/WebCore/html/WeekInputType.cpp @@ -39,6 +39,12 @@ #if ENABLE(INPUT_TYPE_WEEK) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +#include "DateTimeFieldsState.h" +#include "LocalizedStrings.h" +#include <wtf/text/WTFString.h> +#endif + namespace WebCore { using namespace HTMLNames; @@ -91,6 +97,25 @@ bool WeekInputType::isWeekField() const return true; } + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +String WeekInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +{ + if (!dateTimeFieldsState.hasYear() || !dateTimeFieldsState.hasWeekOfYear()) + return emptyString(); + return String::format("%04u-W%02u", dateTimeFieldsState.year(), dateTimeFieldsState.weekOfYear()); +} + +void WeekInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents&) const +{ + layoutParameters.dateTimeFormat = weekFormatInLDML(); + layoutParameters.fallbackDateTimeFormat = "'Week' ww-yyyy"; + layoutParameters.minimumYear = fullYear(element()->fastGetAttribute(minAttr)); + layoutParameters.maximumYear = fullYear(element()->fastGetAttribute(maxAttr)); + layoutParameters.placeholderForYear = "----"; +} +#endif + } // namespace WebCore #endif diff --git a/Source/WebCore/html/WeekInputType.h b/Source/WebCore/html/WeekInputType.h index cc58ab7d0..a88172009 100644 --- a/Source/WebCore/html/WeekInputType.h +++ b/Source/WebCore/html/WeekInputType.h @@ -31,24 +31,36 @@ #ifndef WeekInputType_h #define WeekInputType_h -#include "BaseDateAndTimeInputType.h" +#include "BaseMultipleFieldsDateAndTimeInputType.h" #if ENABLE(INPUT_TYPE_WEEK) namespace WebCore { -class WeekInputType : public BaseDateAndTimeInputType { +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) +typedef BaseMultipleFieldsDateAndTimeInputType BaseWeekInputType; +#else +typedef BaseDateAndTimeInputType BaseWeekInputType; +#endif + +class WeekInputType : public BaseWeekInputType { public: static PassOwnPtr<InputType> create(HTMLInputElement*); private: - WeekInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { } + WeekInputType(HTMLInputElement* element) : BaseWeekInputType(element) { } virtual const AtomicString& formControlType() const OVERRIDE; virtual DateComponents::Type dateType() const OVERRIDE; virtual StepRange createStepRange(AnyStepHandling) const OVERRIDE; virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; virtual bool isWeekField() const OVERRIDE; + +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) + // BaseMultipleFieldsDateAndTimeInputType functions + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL; + virtual void setupLayoutParameters(DateTimeEditElement::LayoutParameters&, const DateComponents&) const OVERRIDE FINAL; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/html/canvas/ArrayBuffer.idl b/Source/WebCore/html/canvas/ArrayBuffer.idl index 6e7663dba..b3f013be5 100644 --- a/Source/WebCore/html/canvas/ArrayBuffer.idl +++ b/Source/WebCore/html/canvas/ArrayBuffer.idl @@ -23,16 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + JSGenerateIsReachable=Impl, + CustomConstructor, + ConstructorParameters=1, + JSNoStaticTables +] interface ArrayBuffer { + readonly attribute unsigned long byteLength; + ArrayBuffer slice(in long begin, in [Optional] long end); +}; - interface [ - JSGenerateIsReachable=Impl, - CustomConstructor, - ConstructorParameters=1, - JSNoStaticTables - ] ArrayBuffer { - readonly attribute unsigned long byteLength; - ArrayBuffer slice(in long begin, in [Optional] long end); - }; - -} diff --git a/Source/WebCore/html/canvas/ArrayBufferView.idl b/Source/WebCore/html/canvas/ArrayBufferView.idl index 0e934e6cb..1c18e186b 100644 --- a/Source/WebCore/html/canvas/ArrayBufferView.idl +++ b/Source/WebCore/html/canvas/ArrayBufferView.idl @@ -23,14 +23,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - CustomToJSObject, - JSNoStaticTables, - OmitConstructor - ] ArrayBufferView { - readonly attribute ArrayBuffer buffer; - readonly attribute unsigned long byteOffset; - readonly attribute unsigned long byteLength; - }; -} +[ + CustomToJSObject, + JSNoStaticTables, + OmitConstructor +] interface ArrayBufferView { + readonly attribute ArrayBuffer buffer; + readonly attribute unsigned long byteOffset; + readonly attribute unsigned long byteLength; +}; diff --git a/Source/WebCore/html/canvas/CanvasGradient.idl b/Source/WebCore/html/canvas/CanvasGradient.idl index 496d4c1b1..f35a68b40 100644 --- a/Source/WebCore/html/canvas/CanvasGradient.idl +++ b/Source/WebCore/html/canvas/CanvasGradient.idl @@ -23,15 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +interface CanvasGradient { - interface CanvasGradient { + void addColorStop(in [Optional=DefaultIsUndefined] float offset, + in [Optional=DefaultIsUndefined] DOMString color) + raises (DOMException); - void addColorStop(in [Optional=DefaultIsUndefined] float offset, - in [Optional=DefaultIsUndefined] DOMString color) - raises (DOMException); - - }; - -} +}; diff --git a/Source/WebCore/html/canvas/CanvasPattern.idl b/Source/WebCore/html/canvas/CanvasPattern.idl index e5aa0360b..7bcab17ac 100644 --- a/Source/WebCore/html/canvas/CanvasPattern.idl +++ b/Source/WebCore/html/canvas/CanvasPattern.idl @@ -23,10 +23,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - - interface CanvasPattern { - }; - -} +interface CanvasPattern { +}; diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext.idl b/Source/WebCore/html/canvas/CanvasRenderingContext.idl index ab5beb189..c48e68161 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext.idl @@ -23,14 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + JSCustomMarkFunction, + JSGenerateIsReachable, + CustomToJSObject +] interface CanvasRenderingContext { + readonly attribute HTMLCanvasElement canvas; +}; - interface [ - JSCustomMarkFunction, - JSGenerateIsReachable, - CustomToJSObject - ] CanvasRenderingContext { - readonly attribute HTMLCanvasElement canvas; - }; - -} diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h index 95d6d0e43..463712ea5 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -40,7 +40,7 @@ #include <wtf/text/WTFString.h> #if USE(ACCELERATED_COMPOSITING) -#include "GraphicsLayer.h" +#include "PlatformLayer.h" #endif namespace WebCore { diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl index a8569487a..6bfc594db 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -23,221 +23,217 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - - interface CanvasRenderingContext2D : CanvasRenderingContext { - - void save(); - void restore(); - - void scale(in [Optional=DefaultIsUndefined] float sx, - in [Optional=DefaultIsUndefined] float sy); - void rotate(in [Optional=DefaultIsUndefined] float angle); - void translate(in [Optional=DefaultIsUndefined] float tx, - in [Optional=DefaultIsUndefined] float ty); - void transform(in [Optional=DefaultIsUndefined] float m11, - in [Optional=DefaultIsUndefined] float m12, - in [Optional=DefaultIsUndefined] float m21, - in [Optional=DefaultIsUndefined] float m22, - in [Optional=DefaultIsUndefined] float dx, - in [Optional=DefaultIsUndefined] float dy); - void setTransform(in [Optional=DefaultIsUndefined] float m11, - in [Optional=DefaultIsUndefined] float m12, - in [Optional=DefaultIsUndefined] float m21, - in [Optional=DefaultIsUndefined] float m22, - in [Optional=DefaultIsUndefined] float dx, - in [Optional=DefaultIsUndefined] float dy); - - attribute float globalAlpha; - attribute [TreatNullAs=NullString] DOMString globalCompositeOperation; - - CanvasGradient createLinearGradient(in [Optional=DefaultIsUndefined] float x0, - in [Optional=DefaultIsUndefined] float y0, - in [Optional=DefaultIsUndefined] float x1, - in [Optional=DefaultIsUndefined] float y1) - raises (DOMException); - CanvasGradient createRadialGradient(in [Optional=DefaultIsUndefined] float x0, - in [Optional=DefaultIsUndefined] float y0, - in [Optional=DefaultIsUndefined] float r0, - in [Optional=DefaultIsUndefined] float x1, - in [Optional=DefaultIsUndefined] float y1, - in [Optional=DefaultIsUndefined] float r1) - raises (DOMException); - - attribute float lineWidth; - attribute [TreatNullAs=NullString] DOMString lineCap; - attribute [TreatNullAs=NullString] DOMString lineJoin; - attribute float miterLimit; - - attribute float shadowOffsetX; - attribute float shadowOffsetY; - attribute float shadowBlur; - attribute [TreatNullAs=NullString] DOMString shadowColor; - - void setLineDash(in sequence<float> dash); - sequence<float> getLineDash(); - attribute float lineDashOffset; - - // FIXME: These attributes should also be implemented for V8. +interface CanvasRenderingContext2D : CanvasRenderingContext { + + void save(); + void restore(); + + void scale(in [Optional=DefaultIsUndefined] float sx, + in [Optional=DefaultIsUndefined] float sy); + void rotate(in [Optional=DefaultIsUndefined] float angle); + void translate(in [Optional=DefaultIsUndefined] float tx, + in [Optional=DefaultIsUndefined] float ty); + void transform(in [Optional=DefaultIsUndefined] float m11, + in [Optional=DefaultIsUndefined] float m12, + in [Optional=DefaultIsUndefined] float m21, + in [Optional=DefaultIsUndefined] float m22, + in [Optional=DefaultIsUndefined] float dx, + in [Optional=DefaultIsUndefined] float dy); + void setTransform(in [Optional=DefaultIsUndefined] float m11, + in [Optional=DefaultIsUndefined] float m12, + in [Optional=DefaultIsUndefined] float m21, + in [Optional=DefaultIsUndefined] float m22, + in [Optional=DefaultIsUndefined] float dx, + in [Optional=DefaultIsUndefined] float dy); + + attribute float globalAlpha; + [TreatNullAs=NullString] attribute DOMString globalCompositeOperation; + + CanvasGradient createLinearGradient(in [Optional=DefaultIsUndefined] float x0, + in [Optional=DefaultIsUndefined] float y0, + in [Optional=DefaultIsUndefined] float x1, + in [Optional=DefaultIsUndefined] float y1) + raises (DOMException); + CanvasGradient createRadialGradient(in [Optional=DefaultIsUndefined] float x0, + in [Optional=DefaultIsUndefined] float y0, + in [Optional=DefaultIsUndefined] float r0, + in [Optional=DefaultIsUndefined] float x1, + in [Optional=DefaultIsUndefined] float y1, + in [Optional=DefaultIsUndefined] float r1) + raises (DOMException); + + attribute float lineWidth; + [TreatNullAs=NullString] attribute DOMString lineCap; + [TreatNullAs=NullString] attribute DOMString lineJoin; + attribute float miterLimit; + + attribute float shadowOffsetX; + attribute float shadowOffsetY; + attribute float shadowBlur; + [TreatNullAs=NullString] attribute DOMString shadowColor; + + void setLineDash(in sequence<float> dash); + sequence<float> getLineDash(); + attribute float lineDashOffset; + + // FIXME: These attributes should also be implemented for V8. #if !(defined(V8_BINDING) && V8_BINDING) - attribute [Custom] Array webkitLineDash; - attribute float webkitLineDashOffset; + [Custom] attribute Array webkitLineDash; + attribute float webkitLineDashOffset; #endif - void clearRect(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y, - in [Optional=DefaultIsUndefined] float width, - in [Optional=DefaultIsUndefined] float height); - void fillRect(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y, - in [Optional=DefaultIsUndefined] float width, - in [Optional=DefaultIsUndefined] float height); - - void beginPath(); - void closePath(); - void moveTo(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y); - void lineTo(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y); - void quadraticCurveTo(in [Optional=DefaultIsUndefined] float cpx, - in [Optional=DefaultIsUndefined] float cpy, - in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y); - void bezierCurveTo(in [Optional=DefaultIsUndefined] float cp1x, - in [Optional=DefaultIsUndefined] float cp1y, - in [Optional=DefaultIsUndefined] float cp2x, - in [Optional=DefaultIsUndefined] float cp2y, - in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y); - void arcTo(in [Optional=DefaultIsUndefined] float x1, - in [Optional=DefaultIsUndefined] float y1, - in [Optional=DefaultIsUndefined] float x2, - in [Optional=DefaultIsUndefined] float y2, - in [Optional=DefaultIsUndefined] float radius) - raises (DOMException); - void rect(in [Optional=DefaultIsUndefined] float x, + void clearRect(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y, + in [Optional=DefaultIsUndefined] float width, + in [Optional=DefaultIsUndefined] float height); + void fillRect(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y, in [Optional=DefaultIsUndefined] float width, in [Optional=DefaultIsUndefined] float height); - void arc(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y, - in [Optional=DefaultIsUndefined] float radius, - in [Optional=DefaultIsUndefined] float startAngle, - in [Optional=DefaultIsUndefined] float endAngle, - in [Optional=DefaultIsUndefined] boolean anticlockwise) - raises (DOMException); - void fill(); - void stroke(); - void clip(); - boolean isPointInPath(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y); - - // text - attribute DOMString font; - attribute DOMString textAlign; - attribute DOMString textBaseline; - - TextMetrics measureText(in [Optional=DefaultIsUndefined] DOMString text); - - // other - - void setAlpha(in [Optional=DefaultIsUndefined] float alpha); - void setCompositeOperation(in [Optional=DefaultIsUndefined] DOMString compositeOperation); + + void beginPath(); + void closePath(); + void moveTo(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y); + void lineTo(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y); + void quadraticCurveTo(in [Optional=DefaultIsUndefined] float cpx, + in [Optional=DefaultIsUndefined] float cpy, + in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y); + void bezierCurveTo(in [Optional=DefaultIsUndefined] float cp1x, + in [Optional=DefaultIsUndefined] float cp1y, + in [Optional=DefaultIsUndefined] float cp2x, + in [Optional=DefaultIsUndefined] float cp2y, + in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y); + void arcTo(in [Optional=DefaultIsUndefined] float x1, + in [Optional=DefaultIsUndefined] float y1, + in [Optional=DefaultIsUndefined] float x2, + in [Optional=DefaultIsUndefined] float y2, + in [Optional=DefaultIsUndefined] float radius) + raises (DOMException); + void rect(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y, + in [Optional=DefaultIsUndefined] float width, + in [Optional=DefaultIsUndefined] float height); + void arc(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y, + in [Optional=DefaultIsUndefined] float radius, + in [Optional=DefaultIsUndefined] float startAngle, + in [Optional=DefaultIsUndefined] float endAngle, + in [Optional=DefaultIsUndefined] boolean anticlockwise) + raises (DOMException); + void fill(); + void stroke(); + void clip(); + boolean isPointInPath(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y); + + // text + attribute DOMString font; + attribute DOMString textAlign; + attribute DOMString textBaseline; + + TextMetrics measureText(in [Optional=DefaultIsUndefined] DOMString text); + + // other + + void setAlpha(in [Optional=DefaultIsUndefined] float alpha); + void setCompositeOperation(in [Optional=DefaultIsUndefined] DOMString compositeOperation); #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - void setLineWidth(in [Optional=DefaultIsUndefined] float width); - void setLineCap(in [Optional=DefaultIsUndefined] DOMString cap); - void setLineJoin(in [Optional=DefaultIsUndefined] DOMString join); - void setMiterLimit(in [Optional=DefaultIsUndefined] float limit); + void setLineWidth(in [Optional=DefaultIsUndefined] float width); + void setLineCap(in [Optional=DefaultIsUndefined] DOMString cap); + void setLineJoin(in [Optional=DefaultIsUndefined] DOMString join); + void setMiterLimit(in [Optional=DefaultIsUndefined] float limit); #endif - void clearShadow(); - - void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth); - void strokeText(in DOMString text, in float x, in float y, in [Optional] float maxWidth); - - void setStrokeColor(in DOMString color, in [Optional] float alpha); - void setStrokeColor(in float grayLevel, in [Optional] float alpha); - void setStrokeColor(in float r, in float g, in float b, in float a); - void setStrokeColor(in float c, in float m, in float y, in float k, in float a); - - void setFillColor(in DOMString color, in [Optional] float alpha); - void setFillColor(in float grayLevel, in [Optional] float alpha); - void setFillColor(in float r, in float g, in float b, in float a); - void setFillColor(in float c, in float m, in float y, in float k, in float a); - - void strokeRect(in [Optional=DefaultIsUndefined] float x, - in [Optional=DefaultIsUndefined] float y, - in [Optional=DefaultIsUndefined] float width, - in [Optional=DefaultIsUndefined] float height, - in [Optional] float lineWidth); - - void drawImage(in HTMLImageElement? image, in float x, in float y) - raises (DOMException); - void drawImage(in HTMLImageElement? image, in float x, in float y, in float width, in float height) - raises (DOMException); - void drawImage(in HTMLImageElement? image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) - raises (DOMException); - void drawImage(in HTMLCanvasElement? canvas, in float x, in float y) - raises (DOMException); - void drawImage(in HTMLCanvasElement? canvas, in float x, in float y, in float width, in float height) - raises (DOMException); - void drawImage(in HTMLCanvasElement? canvas, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) - raises (DOMException); + void clearShadow(); + + void fillText(in DOMString text, in float x, in float y, in [Optional] float maxWidth); + void strokeText(in DOMString text, in float x, in float y, in [Optional] float maxWidth); + + void setStrokeColor(in [StrictTypeChecking] DOMString color, in [Optional] float alpha); + void setStrokeColor(in float grayLevel, in [Optional] float alpha); + void setStrokeColor(in float r, in float g, in float b, in float a); + void setStrokeColor(in float c, in float m, in float y, in float k, in float a); + + void setFillColor(in [StrictTypeChecking] DOMString color, in [Optional] float alpha); + void setFillColor(in float grayLevel, in [Optional] float alpha); + void setFillColor(in float r, in float g, in float b, in float a); + void setFillColor(in float c, in float m, in float y, in float k, in float a); + + void strokeRect(in [Optional=DefaultIsUndefined] float x, + in [Optional=DefaultIsUndefined] float y, + in [Optional=DefaultIsUndefined] float width, + in [Optional=DefaultIsUndefined] float height, + in [Optional] float lineWidth); + + void drawImage(in HTMLImageElement? image, in float x, in float y) + raises (DOMException); + void drawImage(in HTMLImageElement? image, in float x, in float y, in float width, in float height) + raises (DOMException); + void drawImage(in HTMLImageElement? image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) + raises (DOMException); + void drawImage(in HTMLCanvasElement? canvas, in float x, in float y) + raises (DOMException); + void drawImage(in HTMLCanvasElement? canvas, in float x, in float y, in float width, in float height) + raises (DOMException); + void drawImage(in HTMLCanvasElement? canvas, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) + raises (DOMException); #if defined(ENABLE_VIDEO) && ENABLE_VIDEO - void drawImage(in HTMLVideoElement? video, in float x, in float y) - raises (DOMException); - void drawImage(in HTMLVideoElement? video, in float x, in float y, in float width, in float height) - raises (DOMException); - void drawImage(in HTMLVideoElement? video, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) - raises (DOMException); + void drawImage(in HTMLVideoElement? video, in float x, in float y) + raises (DOMException); + void drawImage(in HTMLVideoElement? video, in float x, in float y, in float width, in float height) + raises (DOMException); + void drawImage(in HTMLVideoElement? video, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh) + raises (DOMException); #endif - void drawImageFromRect(in HTMLImageElement image, - in [Optional] float sx, in [Optional] float sy, in [Optional] float sw, in [Optional] float sh, - in [Optional] float dx, in [Optional] float dy, in [Optional] float dw, in [Optional] float dh, - in [Optional] DOMString compositeOperation); - - void setShadow(in float width, in float height, in float blur, in [Optional] DOMString color, in [Optional] float alpha); - void setShadow(in float width, in float height, in float blur, in float grayLevel, in [Optional] float alpha); - void setShadow(in float width, in float height, in float blur, in float r, in float g, in float b, in float a); - void setShadow(in float width, in float height, in float blur, in float c, in float m, in float y, in float k, in float a); - - void putImageData(in ImageData? imagedata, in float dx, in float dy) - raises(DOMException); - void putImageData(in ImageData? imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) - raises(DOMException); - - void webkitPutImageDataHD(in ImageData? imagedata, in float dx, in float dy) - raises(DOMException); - void webkitPutImageDataHD(in ImageData? imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) - raises(DOMException); - - CanvasPattern createPattern(in HTMLCanvasElement? canvas, in [TreatNullAs=NullString] DOMString repetitionType) - raises (DOMException); - CanvasPattern createPattern(in HTMLImageElement? image, in [TreatNullAs=NullString] DOMString repetitionType) - raises (DOMException); - ImageData createImageData(in ImageData? imagedata) - raises (DOMException); - ImageData createImageData(in float sw, in float sh) - raises (DOMException); - - attribute [Custom] custom strokeStyle; - attribute [Custom] custom fillStyle; - - // pixel manipulation - ImageData getImageData(in [Optional=DefaultIsUndefined] float sx, in [Optional=DefaultIsUndefined] float sy, - in [Optional=DefaultIsUndefined] float sw, in [Optional=DefaultIsUndefined] float sh) - raises(DOMException); - - ImageData webkitGetImageDataHD(in [Optional=DefaultIsUndefined] float sx, in [Optional=DefaultIsUndefined] float sy, - in [Optional=DefaultIsUndefined] float sw, in [Optional=DefaultIsUndefined] float sh) - raises(DOMException); - - readonly attribute float webkitBackingStorePixelRatio; - - attribute boolean webkitImageSmoothingEnabled; - }; - -} + void drawImageFromRect(in HTMLImageElement image, + in [Optional] float sx, in [Optional] float sy, in [Optional] float sw, in [Optional] float sh, + in [Optional] float dx, in [Optional] float dy, in [Optional] float dw, in [Optional] float dh, + in [Optional] DOMString compositeOperation); + + void setShadow(in float width, in float height, in float blur, in [Optional, StrictTypeChecking] DOMString color, in [Optional] float alpha); + void setShadow(in float width, in float height, in float blur, in float grayLevel, in [Optional] float alpha); + void setShadow(in float width, in float height, in float blur, in float r, in float g, in float b, in float a); + void setShadow(in float width, in float height, in float blur, in float c, in float m, in float y, in float k, in float a); + + void putImageData(in ImageData? imagedata, in float dx, in float dy) + raises(DOMException); + void putImageData(in ImageData? imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) + raises(DOMException); + + void webkitPutImageDataHD(in ImageData? imagedata, in float dx, in float dy) + raises(DOMException); + void webkitPutImageDataHD(in ImageData? imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) + raises(DOMException); + + CanvasPattern createPattern(in HTMLCanvasElement? canvas, in [TreatNullAs=NullString] DOMString repetitionType) + raises (DOMException); + CanvasPattern createPattern(in HTMLImageElement? image, in [TreatNullAs=NullString] DOMString repetitionType) + raises (DOMException); + ImageData createImageData(in ImageData? imagedata) + raises (DOMException); + ImageData createImageData(in float sw, in float sh) + raises (DOMException); + + [Custom] attribute custom strokeStyle; + [Custom] attribute custom fillStyle; + + // pixel manipulation + ImageData getImageData(in [Optional=DefaultIsUndefined] float sx, in [Optional=DefaultIsUndefined] float sy, + in [Optional=DefaultIsUndefined] float sw, in [Optional=DefaultIsUndefined] float sh) + raises(DOMException); + + ImageData webkitGetImageDataHD(in [Optional=DefaultIsUndefined] float sx, in [Optional=DefaultIsUndefined] float sy, + in [Optional=DefaultIsUndefined] float sw, in [Optional=DefaultIsUndefined] float sh) + raises(DOMException); + + readonly attribute float webkitBackingStorePixelRatio; + + attribute boolean webkitImageSmoothingEnabled; +}; diff --git a/Source/WebCore/html/canvas/DataView.idl b/Source/WebCore/html/canvas/DataView.idl index 3f4dcdf4d..e4ad072ab 100755 --- a/Source/WebCore/html/canvas/DataView.idl +++ b/Source/WebCore/html/canvas/DataView.idl @@ -23,59 +23,56 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + CustomConstructor, + ConstructorParameters=3, + CustomToJSObject, + JSNoStaticTables +] interface DataView : ArrayBufferView { + // All these methods raise an exception if they would read or write beyond the end of the view. - interface [ - CustomConstructor, - ConstructorParameters=3, - CustomToJSObject, - JSNoStaticTables - ] DataView : ArrayBufferView { - // All these methods raise an exception if they would read or write beyond the end of the view. + // We have to use custom code because our code generator does not support int8_t type. + // int8_t getInt8(in unsigned long byteOffset); + // uint8_t getUint8(in unsigned long byteOffset); + [Custom] DOMObject getInt8() + raises (DOMException); + [Custom] DOMObject getUint8() + raises (DOMException); - // We have to use custom code because our code generator does not support int8_t type. - // int8_t getInt8(in unsigned long byteOffset); - // uint8_t getUint8(in unsigned long byteOffset); - [Custom] DOMObject getInt8() - raises (DOMException); - [Custom] DOMObject getUint8() - raises (DOMException); + [StrictTypeChecking] short getInt16(in unsigned long byteOffset, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] unsigned short getUint16(in unsigned long byteOffset, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] long getInt32(in unsigned long byteOffset, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] unsigned long getUint32(in unsigned long byteOffset, in [Optional] boolean littleEndian) + raises (DOMException); - [StrictTypeChecking] short getInt16(in unsigned long byteOffset, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] unsigned short getUint16(in unsigned long byteOffset, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] long getInt32(in unsigned long byteOffset, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] unsigned long getUint32(in unsigned long byteOffset, in [Optional] boolean littleEndian) - raises (DOMException); + // Use custom code to handle NaN case for JSC. + [JSCustom, StrictTypeChecking] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian) + raises (DOMException); + [JSCustom, StrictTypeChecking] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian) + raises (DOMException); - // Use custom code to handle NaN case for JSC. - [JSCustom, StrictTypeChecking] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian) - raises (DOMException); - [JSCustom, StrictTypeChecking] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian) - raises (DOMException); + // We have to use custom code because our code generator does not support uint8_t type. + // void setInt8(in unsigned long byteOffset, in int8_t value); + // void setUint8(in unsigned long byteOffset, in uint8_t value); + [Custom] void setInt8() + raises (DOMException); + [Custom] void setUint8() + raises (DOMException); - // We have to use custom code because our code generator does not support uint8_t type. - // void setInt8(in unsigned long byteOffset, in int8_t value); - // void setUint8(in unsigned long byteOffset, in uint8_t value); - [Custom] void setInt8() - raises (DOMException); - [Custom] void setUint8() - raises (DOMException); + [StrictTypeChecking] void setInt16(in unsigned long byteOffset, in short value, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] void setUint16(in unsigned long byteOffset, in unsigned short value, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] void setInt32(in unsigned long byteOffset, in long value, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] void setUint32(in unsigned long byteOffset, in unsigned long value, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] void setFloat32(in unsigned long byteOffset, in float value, in [Optional] boolean littleEndian) + raises (DOMException); + [StrictTypeChecking] void setFloat64(in unsigned long byteOffset, in double value, in [Optional] boolean littleEndian) + raises (DOMException); +}; - [StrictTypeChecking] void setInt16(in unsigned long byteOffset, in short value, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] void setUint16(in unsigned long byteOffset, in unsigned short value, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] void setInt32(in unsigned long byteOffset, in long value, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] void setUint32(in unsigned long byteOffset, in unsigned long value, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] void setFloat32(in unsigned long byteOffset, in float value, in [Optional] boolean littleEndian) - raises (DOMException); - [StrictTypeChecking] void setFloat64(in unsigned long byteOffset, in double value, in [Optional] boolean littleEndian) - raises (DOMException); - }; - -} diff --git a/Source/WebCore/html/canvas/EXTTextureFilterAnisotropic.idl b/Source/WebCore/html/canvas/EXTTextureFilterAnisotropic.idl index 568aa9a3d..07668e737 100644 --- a/Source/WebCore/html/canvas/EXTTextureFilterAnisotropic.idl +++ b/Source/WebCore/html/canvas/EXTTextureFilterAnisotropic.idl @@ -23,14 +23,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor, - DoNotCheckConstants - ] EXTTextureFilterAnisotropic { - const unsigned int TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; - const unsigned int MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor, + DoNotCheckConstants +] interface EXTTextureFilterAnisotropic { + const unsigned int TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; + const unsigned int MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; +}; diff --git a/Source/WebCore/html/canvas/Float32Array.idl b/Source/WebCore/html/canvas/Float32Array.idl index b445eb40d..e37f42d43 100644 --- a/Source/WebCore/html/canvas/Float32Array.idl +++ b/Source/WebCore/html/canvas/Float32Array.idl @@ -24,26 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=float - ] Float32Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 4; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=float +] interface Float32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; - readonly attribute unsigned long length; - Float32Array subarray(in [Optional=DefaultIsUndefined] long start, - in [Optional] long end); + readonly attribute unsigned long length; + Float32Array subarray(in [Optional=DefaultIsUndefined] long start, + in [Optional] long end); - // void set(in Float32Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Float32Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Float64Array.idl b/Source/WebCore/html/canvas/Float64Array.idl index da4b483a1..0b938b53b 100644 --- a/Source/WebCore/html/canvas/Float64Array.idl +++ b/Source/WebCore/html/canvas/Float64Array.idl @@ -24,26 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=double - ] Float64Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 8; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=double +] interface Float64Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 8; - readonly attribute unsigned long length; - Float64Array subarray(in [Optional=DefaultIsUndefined] long start, - in [Optional] long end); + readonly attribute unsigned long length; + Float64Array subarray(in [Optional=DefaultIsUndefined] long start, + in [Optional] long end); - // void set(in Float64Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Float64Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Int16Array.idl b/Source/WebCore/html/canvas/Int16Array.idl index 9f98bea93..07789d37d 100644 --- a/Source/WebCore/html/canvas/Int16Array.idl +++ b/Source/WebCore/html/canvas/Int16Array.idl @@ -23,26 +23,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=short - ] Int16Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 2; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=short +] interface Int16Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 2; - readonly attribute unsigned long length; - Int16Array subarray(in [Optional=DefaultIsUndefined] long start, - in [Optional] long end); + readonly attribute unsigned long length; + Int16Array subarray(in [Optional=DefaultIsUndefined] long start, + in [Optional] long end); - // void set(in Int16Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Int16Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Int32Array.idl b/Source/WebCore/html/canvas/Int32Array.idl index 87cd7587c..6ef836aa3 100644 --- a/Source/WebCore/html/canvas/Int32Array.idl +++ b/Source/WebCore/html/canvas/Int32Array.idl @@ -24,26 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=int - ] Int32Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 4; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=int +] interface Int32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; - readonly attribute unsigned long length; - Int32Array subarray(in [Optional=DefaultIsUndefined] long start, - in [Optional] long end); + readonly attribute unsigned long length; + Int32Array subarray(in [Optional=DefaultIsUndefined] long start, + in [Optional] long end); - // void set(in Int32Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Int32Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Int8Array.idl b/Source/WebCore/html/canvas/Int8Array.idl index 10cf12003..8b38ca3b8 100644 --- a/Source/WebCore/html/canvas/Int8Array.idl +++ b/Source/WebCore/html/canvas/Int8Array.idl @@ -24,26 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=signed char - ] Int8Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 1; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=signed char +] interface Int8Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 1; - readonly attribute unsigned long length; - Int8Array subarray(in [Optional=DefaultIsUndefined] long start, - in [Optional] long end); + readonly attribute unsigned long length; + Int8Array subarray(in [Optional=DefaultIsUndefined] long start, + in [Optional] long end); - // void set(in Int8Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Int8Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.idl b/Source/WebCore/html/canvas/OESStandardDerivatives.idl index 93f0a01d8..c4eb48da4 100644 --- a/Source/WebCore/html/canvas/OESStandardDerivatives.idl +++ b/Source/WebCore/html/canvas/OESStandardDerivatives.idl @@ -23,13 +23,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor, - DoNotCheckConstants - ] OESStandardDerivatives { - const unsigned int FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor, + DoNotCheckConstants +] interface OESStandardDerivatives { + const unsigned int FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; +}; diff --git a/Source/WebCore/html/canvas/OESTextureFloat.idl b/Source/WebCore/html/canvas/OESTextureFloat.idl index 6537f4707..2d1b3c5f7 100644 --- a/Source/WebCore/html/canvas/OESTextureFloat.idl +++ b/Source/WebCore/html/canvas/OESTextureFloat.idl @@ -23,11 +23,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor - ] OESTextureFloat { - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor +] interface OESTextureFloat { +}; diff --git a/Source/WebCore/html/canvas/OESVertexArrayObject.idl b/Source/WebCore/html/canvas/OESVertexArrayObject.idl index c3d366676..f2339067d 100644 --- a/Source/WebCore/html/canvas/OESVertexArrayObject.idl +++ b/Source/WebCore/html/canvas/OESVertexArrayObject.idl @@ -23,18 +23,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor, - DoNotCheckConstants - ] OESVertexArrayObject { - const unsigned int VERTEX_ARRAY_BINDING_OES = 0x85B5; - - [StrictTypeChecking] WebGLVertexArrayObjectOES createVertexArrayOES(); - [StrictTypeChecking] void deleteVertexArrayOES(in [Optional=DefaultIsUndefined] WebGLVertexArrayObjectOES arrayObject); - [StrictTypeChecking] boolean isVertexArrayOES(in [Optional=DefaultIsUndefined] WebGLVertexArrayObjectOES arrayObject); - [StrictTypeChecking] void bindVertexArrayOES(in [Optional=DefaultIsUndefined] WebGLVertexArrayObjectOES arrayObject) raises(DOMException); - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor, + DoNotCheckConstants +] interface OESVertexArrayObject { + const unsigned int VERTEX_ARRAY_BINDING_OES = 0x85B5; + + [StrictTypeChecking] WebGLVertexArrayObjectOES createVertexArrayOES(); + [StrictTypeChecking] void deleteVertexArrayOES(in [Optional=DefaultIsUndefined] WebGLVertexArrayObjectOES arrayObject); + [StrictTypeChecking] boolean isVertexArrayOES(in [Optional=DefaultIsUndefined] WebGLVertexArrayObjectOES arrayObject); + [StrictTypeChecking] void bindVertexArrayOES(in [Optional=DefaultIsUndefined] WebGLVertexArrayObjectOES arrayObject) raises(DOMException); +}; diff --git a/Source/WebCore/html/canvas/Uint16Array.idl b/Source/WebCore/html/canvas/Uint16Array.idl index 72998a35d..4e0802258 100644 --- a/Source/WebCore/html/canvas/Uint16Array.idl +++ b/Source/WebCore/html/canvas/Uint16Array.idl @@ -24,25 +24,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=unsigned short - ] Uint16Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 2; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=unsigned short +] interface Uint16Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 2; - readonly attribute unsigned long length; - Uint16Array subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); + readonly attribute unsigned long length; + Uint16Array subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); - // void set(in Uint16Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Uint16Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Uint32Array.idl b/Source/WebCore/html/canvas/Uint32Array.idl index 65c44bef9..8d34293f9 100644 --- a/Source/WebCore/html/canvas/Uint32Array.idl +++ b/Source/WebCore/html/canvas/Uint32Array.idl @@ -24,25 +24,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=unsigned int - ] Uint32Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 4; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=unsigned int +] interface Uint32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; - readonly attribute unsigned long length; - Uint32Array subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); + readonly attribute unsigned long length; + Uint32Array subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); - // void set(in Uint32Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Uint32Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Uint8Array.idl b/Source/WebCore/html/canvas/Uint8Array.idl index f6ef9377d..65d2312cf 100644 --- a/Source/WebCore/html/canvas/Uint8Array.idl +++ b/Source/WebCore/html/canvas/Uint8Array.idl @@ -24,25 +24,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=unsigned char - ] Uint8Array : ArrayBufferView { - const unsigned long BYTES_PER_ELEMENT = 1; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=unsigned char +] interface Uint8Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 1; - readonly attribute unsigned long length; - Uint8Array subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); + readonly attribute unsigned long length; + Uint8Array subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); - // void set(in Uint8Array array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // void set(in Uint8Array array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/Uint8ClampedArray.idl b/Source/WebCore/html/canvas/Uint8ClampedArray.idl index c646e57e9..efcc98a38 100644 --- a/Source/WebCore/html/canvas/Uint8ClampedArray.idl +++ b/Source/WebCore/html/canvas/Uint8ClampedArray.idl @@ -24,26 +24,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - ConstructorTemplate=TypedArray, - ConstructorParameters=1, - NumericIndexedGetter, - CustomIndexedSetter, - JSGenerateToNativeObject, - JSNoStaticTables, - CustomToJSObject, - DoNotCheckConstants, - TypedArray=unsigned char - ] Uint8ClampedArray : Uint8Array { - const unsigned long BYTES_PER_ELEMENT = 1; +[ + ConstructorTemplate=TypedArray, + ConstructorParameters=1, + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + CustomToJSObject, + DoNotCheckConstants, + TypedArray=unsigned char +] interface Uint8ClampedArray : Uint8Array { + const unsigned long BYTES_PER_ELEMENT = 1; - readonly attribute unsigned long length; - Uint8ClampedArray subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); + readonly attribute unsigned long length; + Uint8ClampedArray subarray(in [Optional=DefaultIsUndefined] long start, in [Optional] long end); - // FIXME: Missing other setters! - // void set(in Uint8ClampedArray array, [Optional] in unsigned long offset); - // void set(in sequence<long> array, [Optional] in unsigned long offset); - void set(); - }; -} + // FIXME: Missing other setters! + // void set(in Uint8ClampedArray array, [Optional] in unsigned long offset); + // void set(in sequence<long> array, [Optional] in unsigned long offset); + void set(); +}; diff --git a/Source/WebCore/html/canvas/WebGLActiveInfo.idl b/Source/WebCore/html/canvas/WebGLActiveInfo.idl index e9fef93b3..47789bd50 100644 --- a/Source/WebCore/html/canvas/WebGLActiveInfo.idl +++ b/Source/WebCore/html/canvas/WebGLActiveInfo.idl @@ -23,14 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=WEBGL, +] interface WebGLActiveInfo { + readonly attribute long size; + readonly attribute unsigned long type; + readonly attribute DOMString name; +}; - interface [ - Conditional=WEBGL, - ] WebGLActiveInfo { - readonly attribute long size; - readonly attribute unsigned long type; - readonly attribute DOMString name; - }; - -} diff --git a/Source/WebCore/html/canvas/WebGLBuffer.idl b/Source/WebCore/html/canvas/WebGLBuffer.idl index 312b00911..f43cd6353 100644 --- a/Source/WebCore/html/canvas/WebGLBuffer.idl +++ b/Source/WebCore/html/canvas/WebGLBuffer.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - ] WebGLBuffer { - }; -} +[ + Conditional=WEBGL, +] interface WebGLBuffer { +}; diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl index 7fde5bba9..6642d28a5 100644 --- a/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl @@ -23,17 +23,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor, - DoNotCheckConstants - ] WebGLCompressedTextureS3TC { - /* Compressed Texture Formats */ - const unsigned int COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; - const unsigned int COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; - const unsigned int COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; - const unsigned int COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor, + DoNotCheckConstants +] interface WebGLCompressedTextureS3TC { + /* Compressed Texture Formats */ + const unsigned int COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; + const unsigned int COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; + const unsigned int COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; + const unsigned int COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; +}; diff --git a/Source/WebCore/html/canvas/WebGLContextAttributes.idl b/Source/WebCore/html/canvas/WebGLContextAttributes.idl index 56da1c61e..52dd041d8 100644 --- a/Source/WebCore/html/canvas/WebGLContextAttributes.idl +++ b/Source/WebCore/html/canvas/WebGLContextAttributes.idl @@ -24,16 +24,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - OmitConstructor - ] WebGLContextAttributes { - attribute boolean alpha; - attribute boolean depth; - attribute boolean stencil; - attribute boolean antialias; - attribute boolean premultipliedAlpha; - attribute boolean preserveDrawingBuffer; - }; -} +[ + Conditional=WEBGL, + OmitConstructor +] interface WebGLContextAttributes { + attribute boolean alpha; + attribute boolean depth; + attribute boolean stencil; + attribute boolean antialias; + attribute boolean premultipliedAlpha; + attribute boolean preserveDrawingBuffer; +}; diff --git a/Source/WebCore/html/canvas/WebGLContextEvent.idl b/Source/WebCore/html/canvas/WebGLContextEvent.idl index 3735f1245..c3eba1029 100644 --- a/Source/WebCore/html/canvas/WebGLContextEvent.idl +++ b/Source/WebCore/html/canvas/WebGLContextEvent.idl @@ -23,13 +23,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=WEBGL, + ConstructorTemplate=Event +] interface WebGLContextEvent : Event { + [InitializedByEventConstructor] readonly attribute DOMString statusMessage; +}; - interface [ - Conditional=WEBGL, - ConstructorTemplate=Event - ] WebGLContextEvent : Event { - readonly attribute [InitializedByEventConstructor] DOMString statusMessage; - }; - -} diff --git a/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl b/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl index b307a1498..c7ae7f80d 100644 --- a/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl +++ b/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl @@ -23,14 +23,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor, - DoNotCheckConstants - ] WebGLDebugRendererInfo { - const unsigned int UNMASKED_VENDOR_WEBGL = 0x9245; - const unsigned int UNMASKED_RENDERER_WEBGL = 0x9246; - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor, + DoNotCheckConstants +] interface WebGLDebugRendererInfo { + const unsigned int UNMASKED_VENDOR_WEBGL = 0x9245; + const unsigned int UNMASKED_RENDERER_WEBGL = 0x9246; +}; diff --git a/Source/WebCore/html/canvas/WebGLDebugShaders.idl b/Source/WebCore/html/canvas/WebGLDebugShaders.idl index ee330b6ae..ed52d4d5b 100644 --- a/Source/WebCore/html/canvas/WebGLDebugShaders.idl +++ b/Source/WebCore/html/canvas/WebGLDebugShaders.idl @@ -23,12 +23,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor - ] WebGLDebugShaders { - [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getTranslatedShaderSource(in WebGLShader shader) raises(DOMException); - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor +] interface WebGLDebugShaders { + [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getTranslatedShaderSource(in WebGLShader shader) raises(DOMException); +}; diff --git a/Source/WebCore/html/canvas/WebGLDepthTexture.idl b/Source/WebCore/html/canvas/WebGLDepthTexture.idl index 56ef537c0..45069ac4e 100644 --- a/Source/WebCore/html/canvas/WebGLDepthTexture.idl +++ b/Source/WebCore/html/canvas/WebGLDepthTexture.idl @@ -23,13 +23,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor, - DoNotCheckConstants - ] WebGLDepthTexture { - const unsigned int UNSIGNED_INT_24_8_WEBGL = 0x84FA; - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor, + DoNotCheckConstants +] interface WebGLDepthTexture { + const unsigned int UNSIGNED_INT_24_8_WEBGL = 0x84FA; +}; diff --git a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp index b91ae506e..d081e2490 100644 --- a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp +++ b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp @@ -327,7 +327,7 @@ WebGLSharedObject* WebGLFramebuffer::getAttachmentObject(GC3Denum attachment) co WebGLFramebuffer::WebGLAttachment* WebGLFramebuffer::getAttachment(GC3Denum attachment) const { const AttachmentMap::const_iterator it = m_attachments.find(attachment); - return (it != m_attachments.end()) ? it->second.get() : 0; + return (it != m_attachments.end()) ? it->value.get() : 0; } void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(GC3Denum attachment) @@ -367,9 +367,9 @@ void WebGLFramebuffer::removeAttachmentFromBoundFramebuffer(WebGLSharedObject* a while (checkMore) { checkMore = false; for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) { - WebGLAttachment* attachmentObject = it->second.get(); + WebGLAttachment* attachmentObject = it->value.get(); if (attachmentObject->isSharedObject(attachment)) { - GC3Denum attachmentType = it->first; + GC3Denum attachmentType = it->key; attachmentObject->unattach(context()->graphicsContext3D(), attachmentType); removeAttachmentFromBoundFramebuffer(attachmentType); checkMore = true; @@ -419,8 +419,8 @@ GC3Denum WebGLFramebuffer::checkStatus(const char** reason) const bool haveStencil = false; bool haveDepthStencil = false; for (AttachmentMap::const_iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) { - WebGLAttachment* attachment = it->second.get(); - if (!isAttachmentComplete(attachment, it->first, reason)) + WebGLAttachment* attachment = it->value.get(); + if (!isAttachmentComplete(attachment, it->key, reason)) return GraphicsContext3D::FRAMEBUFFER_INCOMPLETE_ATTACHMENT; if (!attachment->isValid()) { *reason = "attachment is not valid"; @@ -430,7 +430,7 @@ GC3Denum WebGLFramebuffer::checkStatus(const char** reason) const *reason = "attachment is an unsupported format"; return GraphicsContext3D::FRAMEBUFFER_INCOMPLETE_ATTACHMENT; } - switch (it->first) { + switch (it->key) { case GraphicsContext3D::DEPTH_ATTACHMENT: haveDepth = true; break; @@ -488,7 +488,7 @@ bool WebGLFramebuffer::hasStencilBuffer() const void WebGLFramebuffer::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject object) { for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) - it->second->onDetached(context3d); + it->value->onDetached(context3d); context3d->deleteFramebuffer(object); } @@ -499,8 +499,8 @@ bool WebGLFramebuffer::initializeAttachments(GraphicsContext3D* g3d, const char* GC3Dbitfield mask = 0; for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) { - GC3Denum attachmentType = it->first; - WebGLAttachment* attachment = it->second.get(); + GC3Denum attachmentType = it->key; + WebGLAttachment* attachment = it->value.get(); if (!attachment->isInitialized()) mask |= GraphicsContext3D::getClearBitsByAttachmentType(attachmentType); } @@ -571,8 +571,8 @@ bool WebGLFramebuffer::initializeAttachments(GraphicsContext3D* g3d, const char* g3d->disable(GraphicsContext3D::DITHER); for (AttachmentMap::iterator it = m_attachments.begin(); it != m_attachments.end(); ++it) { - GC3Denum attachmentType = it->first; - WebGLAttachment* attachment = it->second.get(); + GC3Denum attachmentType = it->key; + WebGLAttachment* attachment = it->value.get(); GC3Dbitfield bits = GraphicsContext3D::getClearBitsByAttachmentType(attachmentType); if (bits & mask) attachment->setInitialized(); diff --git a/Source/WebCore/html/canvas/WebGLFramebuffer.idl b/Source/WebCore/html/canvas/WebGLFramebuffer.idl index d0caa917f..e609513b2 100644 --- a/Source/WebCore/html/canvas/WebGLFramebuffer.idl +++ b/Source/WebCore/html/canvas/WebGLFramebuffer.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLFramebuffer { - }; -} +[ + Conditional=WEBGL +] interface WebGLFramebuffer { +}; diff --git a/Source/WebCore/html/canvas/WebGLLoseContext.idl b/Source/WebCore/html/canvas/WebGLLoseContext.idl index 390da2638..fcdd907c0 100644 --- a/Source/WebCore/html/canvas/WebGLLoseContext.idl +++ b/Source/WebCore/html/canvas/WebGLLoseContext.idl @@ -23,13 +23,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL, - JSGenerateIsReachable=ImplContext, - OmitConstructor - ] WebGLLoseContext { - [StrictTypeChecking] void loseContext(); - [StrictTypeChecking] void restoreContext(); - }; -} +[ + Conditional=WEBGL, + JSGenerateIsReachable=ImplContext, + OmitConstructor +] interface WebGLLoseContext { + [StrictTypeChecking] void loseContext(); + [StrictTypeChecking] void restoreContext(); +}; diff --git a/Source/WebCore/html/canvas/WebGLProgram.idl b/Source/WebCore/html/canvas/WebGLProgram.idl index 326f1c376..d404ebdb8 100644 --- a/Source/WebCore/html/canvas/WebGLProgram.idl +++ b/Source/WebCore/html/canvas/WebGLProgram.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLProgram { - }; -} +[ + Conditional=WEBGL +] interface WebGLProgram { +}; diff --git a/Source/WebCore/html/canvas/WebGLRenderbuffer.idl b/Source/WebCore/html/canvas/WebGLRenderbuffer.idl index a6518ea2e..618f9c472 100644 --- a/Source/WebCore/html/canvas/WebGLRenderbuffer.idl +++ b/Source/WebCore/html/canvas/WebGLRenderbuffer.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLRenderbuffer { - }; -} +[ + Conditional=WEBGL +] interface WebGLRenderbuffer { +}; diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index 582ed5d39..749d51914 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -1911,12 +1911,12 @@ void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei c if (!isGLES2Compliant()) vertexAttrib0Simulated = simulateVertexAttrib0(first + count - 1); if (!isGLES2NPOTStrict()) - handleNPOTTextures(true); + handleNPOTTextures("drawArrays", true); m_context->drawArrays(mode, first, count); if (!isGLES2Compliant() && vertexAttrib0Simulated) restoreStatesAfterVertexAttrib0Simulation(); if (!isGLES2NPOTStrict()) - handleNPOTTextures(false); + handleNPOTTextures("drawArrays", false); cleanupAfterGraphicsCall(true); } @@ -1990,12 +1990,12 @@ void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denu vertexAttrib0Simulated = simulateVertexAttrib0(numElements); } if (!isGLES2NPOTStrict()) - handleNPOTTextures(true); + handleNPOTTextures("drawElements", true); m_context->drawElements(mode, count, type, static_cast<GC3Dintptr>(offset)); if (!isGLES2Compliant() && vertexAttrib0Simulated) restoreStatesAfterVertexAttrib0Simulation(); if (!isGLES2NPOTStrict()) - handleNPOTTextures(false); + handleNPOTTextures("drawElements", false); cleanupAfterGraphicsCall(true); } @@ -4570,7 +4570,7 @@ WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(GC3Denum pname) return WebGLGetInfo(Int32Array::create(value, length)); } -void WebGLRenderingContext::handleNPOTTextures(bool prepareToDraw) +void WebGLRenderingContext::handleNPOTTextures(const char* functionName, bool prepareToDraw) { bool resetActiveUnit = false; for (unsigned ii = 0; ii < m_textureUnits.size(); ++ii) { @@ -4586,6 +4586,9 @@ void WebGLRenderingContext::handleNPOTTextures(bool prepareToDraw) WebGLTexture* tex2D; WebGLTexture* texCubeMap; if (prepareToDraw) { + String msg(String("texture bound to texture unit ") + String::number(ii) + + " is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'"); + printGLWarningToConsole(functionName, msg.utf8().data()); tex2D = m_blackTexture2D.get(); texCubeMap = m_blackTextureCubeMap.get(); } else { diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h index 45df6a582..26fc66c5b 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.h +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h @@ -541,7 +541,7 @@ public: GC3Denum format, GC3Denum type, Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&); - void handleNPOTTextures(bool prepareToDraw); + void handleNPOTTextures(const char*, bool); void createFallbackBlackTextures1x1(); diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.idl b/Source/WebCore/html/canvas/WebGLRenderingContext.idl index 9bf6ff544..31fa54c3d 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.idl @@ -23,647 +23,643 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - - interface [ - Conditional=WEBGL, - JSCustomMarkFunction, - DoNotCheckConstants - ] WebGLRenderingContext : CanvasRenderingContext { - - /* ClearBufferMask */ - const unsigned int DEPTH_BUFFER_BIT = 0x00000100; - const unsigned int STENCIL_BUFFER_BIT = 0x00000400; - const unsigned int COLOR_BUFFER_BIT = 0x00004000; - - /* BeginMode */ - const unsigned int POINTS = 0x0000; - const unsigned int LINES = 0x0001; - const unsigned int LINE_LOOP = 0x0002; - const unsigned int LINE_STRIP = 0x0003; - const unsigned int TRIANGLES = 0x0004; - const unsigned int TRIANGLE_STRIP = 0x0005; - const unsigned int TRIANGLE_FAN = 0x0006; - - /* AlphaFunction (not supported in ES20) */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* BlendingFactorDest */ - const unsigned int ZERO = 0; - const unsigned int ONE = 1; - const unsigned int SRC_COLOR = 0x0300; - const unsigned int ONE_MINUS_SRC_COLOR = 0x0301; - const unsigned int SRC_ALPHA = 0x0302; - const unsigned int ONE_MINUS_SRC_ALPHA = 0x0303; - const unsigned int DST_ALPHA = 0x0304; - const unsigned int ONE_MINUS_DST_ALPHA = 0x0305; - - /* BlendingFactorSrc */ - /* ZERO */ - /* ONE */ - const unsigned int DST_COLOR = 0x0306; - const unsigned int ONE_MINUS_DST_COLOR = 0x0307; - const unsigned int SRC_ALPHA_SATURATE = 0x0308; - /* SRC_ALPHA */ - /* ONE_MINUS_SRC_ALPHA */ - /* DST_ALPHA */ - /* ONE_MINUS_DST_ALPHA */ - - /* BlendEquationSeparate */ - const unsigned int FUNC_ADD = 0x8006; - const unsigned int BLEND_EQUATION = 0x8009; - const unsigned int BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ - const unsigned int BLEND_EQUATION_ALPHA = 0x883D; - - /* BlendSubtract */ - const unsigned int FUNC_SUBTRACT = 0x800A; - const unsigned int FUNC_REVERSE_SUBTRACT = 0x800B; - - /* Separate Blend Functions */ - const unsigned int BLEND_DST_RGB = 0x80C8; - const unsigned int BLEND_SRC_RGB = 0x80C9; - const unsigned int BLEND_DST_ALPHA = 0x80CA; - const unsigned int BLEND_SRC_ALPHA = 0x80CB; - const unsigned int CONSTANT_COLOR = 0x8001; - const unsigned int ONE_MINUS_CONSTANT_COLOR = 0x8002; - const unsigned int CONSTANT_ALPHA = 0x8003; - const unsigned int ONE_MINUS_CONSTANT_ALPHA = 0x8004; - const unsigned int BLEND_COLOR = 0x8005; - - /* Buffer Objects */ - const unsigned int ARRAY_BUFFER = 0x8892; - const unsigned int ELEMENT_ARRAY_BUFFER = 0x8893; - const unsigned int ARRAY_BUFFER_BINDING = 0x8894; - const unsigned int ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; - - const unsigned int STREAM_DRAW = 0x88E0; - const unsigned int STATIC_DRAW = 0x88E4; - const unsigned int DYNAMIC_DRAW = 0x88E8; - - const unsigned int BUFFER_SIZE = 0x8764; - const unsigned int BUFFER_USAGE = 0x8765; - - const unsigned int CURRENT_VERTEX_ATTRIB = 0x8626; - - /* CullFaceMode */ - const unsigned int FRONT = 0x0404; - const unsigned int BACK = 0x0405; - const unsigned int FRONT_AND_BACK = 0x0408; - - /* DepthFunction */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* EnableCap */ - const unsigned int TEXTURE_2D = 0x0DE1; - const unsigned int CULL_FACE = 0x0B44; - const unsigned int BLEND = 0x0BE2; - const unsigned int DITHER = 0x0BD0; - const unsigned int STENCIL_TEST = 0x0B90; - const unsigned int DEPTH_TEST = 0x0B71; - const unsigned int SCISSOR_TEST = 0x0C11; - const unsigned int POLYGON_OFFSET_FILL = 0x8037; - const unsigned int SAMPLE_ALPHA_TO_COVERAGE = 0x809E; - const unsigned int SAMPLE_COVERAGE = 0x80A0; - - /* ErrorCode */ - const unsigned int NO_ERROR = 0; - const unsigned int INVALID_ENUM = 0x0500; - const unsigned int INVALID_VALUE = 0x0501; - const unsigned int INVALID_OPERATION = 0x0502; - const unsigned int OUT_OF_MEMORY = 0x0505; - - /* FrontFaceDirection */ - const unsigned int CW = 0x0900; - const unsigned int CCW = 0x0901; - - /* GetPName */ - const unsigned int LINE_WIDTH = 0x0B21; - const unsigned int ALIASED_POINT_SIZE_RANGE = 0x846D; - const unsigned int ALIASED_LINE_WIDTH_RANGE = 0x846E; - const unsigned int CULL_FACE_MODE = 0x0B45; - const unsigned int FRONT_FACE = 0x0B46; - const unsigned int DEPTH_RANGE = 0x0B70; - const unsigned int DEPTH_WRITEMASK = 0x0B72; - const unsigned int DEPTH_CLEAR_VALUE = 0x0B73; - const unsigned int DEPTH_FUNC = 0x0B74; - const unsigned int STENCIL_CLEAR_VALUE = 0x0B91; - const unsigned int STENCIL_FUNC = 0x0B92; - const unsigned int STENCIL_FAIL = 0x0B94; - const unsigned int STENCIL_PASS_DEPTH_FAIL = 0x0B95; - const unsigned int STENCIL_PASS_DEPTH_PASS = 0x0B96; - const unsigned int STENCIL_REF = 0x0B97; - const unsigned int STENCIL_VALUE_MASK = 0x0B93; - const unsigned int STENCIL_WRITEMASK = 0x0B98; - const unsigned int STENCIL_BACK_FUNC = 0x8800; - const unsigned int STENCIL_BACK_FAIL = 0x8801; - const unsigned int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; - const unsigned int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; - const unsigned int STENCIL_BACK_REF = 0x8CA3; - const unsigned int STENCIL_BACK_VALUE_MASK = 0x8CA4; - const unsigned int STENCIL_BACK_WRITEMASK = 0x8CA5; - const unsigned int VIEWPORT = 0x0BA2; - const unsigned int SCISSOR_BOX = 0x0C10; - /* SCISSOR_TEST */ - const unsigned int COLOR_CLEAR_VALUE = 0x0C22; - const unsigned int COLOR_WRITEMASK = 0x0C23; - const unsigned int UNPACK_ALIGNMENT = 0x0CF5; - const unsigned int PACK_ALIGNMENT = 0x0D05; - const unsigned int MAX_TEXTURE_SIZE = 0x0D33; - const unsigned int MAX_VIEWPORT_DIMS = 0x0D3A; - const unsigned int SUBPIXEL_BITS = 0x0D50; - const unsigned int RED_BITS = 0x0D52; - const unsigned int GREEN_BITS = 0x0D53; - const unsigned int BLUE_BITS = 0x0D54; - const unsigned int ALPHA_BITS = 0x0D55; - const unsigned int DEPTH_BITS = 0x0D56; - const unsigned int STENCIL_BITS = 0x0D57; - const unsigned int POLYGON_OFFSET_UNITS = 0x2A00; - /* POLYGON_OFFSET_FILL */ - const unsigned int POLYGON_OFFSET_FACTOR = 0x8038; - const unsigned int TEXTURE_BINDING_2D = 0x8069; - const unsigned int SAMPLE_BUFFERS = 0x80A8; - const unsigned int SAMPLES = 0x80A9; - const unsigned int SAMPLE_COVERAGE_VALUE = 0x80AA; - const unsigned int SAMPLE_COVERAGE_INVERT = 0x80AB; - - /* GetTextureParameter */ - /* TEXTURE_MAG_FILTER */ - /* TEXTURE_MIN_FILTER */ - /* TEXTURE_WRAP_S */ - /* TEXTURE_WRAP_T */ - - const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3; - - /* HintMode */ - const unsigned int DONT_CARE = 0x1100; - const unsigned int FASTEST = 0x1101; - const unsigned int NICEST = 0x1102; - - /* HintTarget */ - const unsigned int GENERATE_MIPMAP_HINT = 0x8192; - - /* DataType */ - const unsigned int BYTE = 0x1400; - const unsigned int UNSIGNED_BYTE = 0x1401; - const unsigned int SHORT = 0x1402; - const unsigned int UNSIGNED_SHORT = 0x1403; - const unsigned int INT = 0x1404; - const unsigned int UNSIGNED_INT = 0x1405; - const unsigned int FLOAT = 0x1406; - - /* PixelFormat */ - const unsigned int DEPTH_COMPONENT = 0x1902; - const unsigned int ALPHA = 0x1906; - const unsigned int RGB = 0x1907; - const unsigned int RGBA = 0x1908; - const unsigned int LUMINANCE = 0x1909; - const unsigned int LUMINANCE_ALPHA = 0x190A; - - /* PixelType */ - /* UNSIGNED_BYTE */ - const unsigned int UNSIGNED_SHORT_4_4_4_4 = 0x8033; - const unsigned int UNSIGNED_SHORT_5_5_5_1 = 0x8034; - const unsigned int UNSIGNED_SHORT_5_6_5 = 0x8363; - - /* Shaders */ - const unsigned int FRAGMENT_SHADER = 0x8B30; - const unsigned int VERTEX_SHADER = 0x8B31; - const unsigned int MAX_VERTEX_ATTRIBS = 0x8869; - const unsigned int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; - const unsigned int MAX_VARYING_VECTORS = 0x8DFC; - const unsigned int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; - const unsigned int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; - const unsigned int MAX_TEXTURE_IMAGE_UNITS = 0x8872; - const unsigned int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; - const unsigned int SHADER_TYPE = 0x8B4F; - const unsigned int DELETE_STATUS = 0x8B80; - const unsigned int LINK_STATUS = 0x8B82; - const unsigned int VALIDATE_STATUS = 0x8B83; - const unsigned int ATTACHED_SHADERS = 0x8B85; - const unsigned int ACTIVE_UNIFORMS = 0x8B86; - const unsigned int ACTIVE_ATTRIBUTES = 0x8B89; - const unsigned int SHADING_LANGUAGE_VERSION = 0x8B8C; - const unsigned int CURRENT_PROGRAM = 0x8B8D; - - /* StencilFunction */ - const unsigned int NEVER = 0x0200; - const unsigned int LESS = 0x0201; - const unsigned int EQUAL = 0x0202; - const unsigned int LEQUAL = 0x0203; - const unsigned int GREATER = 0x0204; - const unsigned int NOTEQUAL = 0x0205; - const unsigned int GEQUAL = 0x0206; - const unsigned int ALWAYS = 0x0207; - - /* StencilOp */ - /* ZERO */ - const unsigned int KEEP = 0x1E00; - const unsigned int REPLACE = 0x1E01; - const unsigned int INCR = 0x1E02; - const unsigned int DECR = 0x1E03; - const unsigned int INVERT = 0x150A; - const unsigned int INCR_WRAP = 0x8507; - const unsigned int DECR_WRAP = 0x8508; - - /* StringName */ - const unsigned int VENDOR = 0x1F00; - const unsigned int RENDERER = 0x1F01; - const unsigned int VERSION = 0x1F02; - - /* TextureMagFilter */ - const unsigned int NEAREST = 0x2600; - const unsigned int LINEAR = 0x2601; - - /* TextureMinFilter */ - /* NEAREST */ - /* LINEAR */ - const unsigned int NEAREST_MIPMAP_NEAREST = 0x2700; - const unsigned int LINEAR_MIPMAP_NEAREST = 0x2701; - const unsigned int NEAREST_MIPMAP_LINEAR = 0x2702; - const unsigned int LINEAR_MIPMAP_LINEAR = 0x2703; - - /* TextureParameterName */ - const unsigned int TEXTURE_MAG_FILTER = 0x2800; - const unsigned int TEXTURE_MIN_FILTER = 0x2801; - const unsigned int TEXTURE_WRAP_S = 0x2802; - const unsigned int TEXTURE_WRAP_T = 0x2803; - - /* TextureTarget */ - /* TEXTURE_2D */ - const unsigned int TEXTURE = 0x1702; - - const unsigned int TEXTURE_CUBE_MAP = 0x8513; - const unsigned int TEXTURE_BINDING_CUBE_MAP = 0x8514; - const unsigned int TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; - const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; - const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; - const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; - const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; - const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; - const unsigned int MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; - - /* TextureUnit */ - const unsigned int TEXTURE0 = 0x84C0; - const unsigned int TEXTURE1 = 0x84C1; - const unsigned int TEXTURE2 = 0x84C2; - const unsigned int TEXTURE3 = 0x84C3; - const unsigned int TEXTURE4 = 0x84C4; - const unsigned int TEXTURE5 = 0x84C5; - const unsigned int TEXTURE6 = 0x84C6; - const unsigned int TEXTURE7 = 0x84C7; - const unsigned int TEXTURE8 = 0x84C8; - const unsigned int TEXTURE9 = 0x84C9; - const unsigned int TEXTURE10 = 0x84CA; - const unsigned int TEXTURE11 = 0x84CB; - const unsigned int TEXTURE12 = 0x84CC; - const unsigned int TEXTURE13 = 0x84CD; - const unsigned int TEXTURE14 = 0x84CE; - const unsigned int TEXTURE15 = 0x84CF; - const unsigned int TEXTURE16 = 0x84D0; - const unsigned int TEXTURE17 = 0x84D1; - const unsigned int TEXTURE18 = 0x84D2; - const unsigned int TEXTURE19 = 0x84D3; - const unsigned int TEXTURE20 = 0x84D4; - const unsigned int TEXTURE21 = 0x84D5; - const unsigned int TEXTURE22 = 0x84D6; - const unsigned int TEXTURE23 = 0x84D7; - const unsigned int TEXTURE24 = 0x84D8; - const unsigned int TEXTURE25 = 0x84D9; - const unsigned int TEXTURE26 = 0x84DA; - const unsigned int TEXTURE27 = 0x84DB; - const unsigned int TEXTURE28 = 0x84DC; - const unsigned int TEXTURE29 = 0x84DD; - const unsigned int TEXTURE30 = 0x84DE; - const unsigned int TEXTURE31 = 0x84DF; - const unsigned int ACTIVE_TEXTURE = 0x84E0; - - /* TextureWrapMode */ - const unsigned int REPEAT = 0x2901; - const unsigned int CLAMP_TO_EDGE = 0x812F; - const unsigned int MIRRORED_REPEAT = 0x8370; - - /* Uniform Types */ - const unsigned int FLOAT_VEC2 = 0x8B50; - const unsigned int FLOAT_VEC3 = 0x8B51; - const unsigned int FLOAT_VEC4 = 0x8B52; - const unsigned int INT_VEC2 = 0x8B53; - const unsigned int INT_VEC3 = 0x8B54; - const unsigned int INT_VEC4 = 0x8B55; - const unsigned int BOOL = 0x8B56; - const unsigned int BOOL_VEC2 = 0x8B57; - const unsigned int BOOL_VEC3 = 0x8B58; - const unsigned int BOOL_VEC4 = 0x8B59; - const unsigned int FLOAT_MAT2 = 0x8B5A; - const unsigned int FLOAT_MAT3 = 0x8B5B; - const unsigned int FLOAT_MAT4 = 0x8B5C; - const unsigned int SAMPLER_2D = 0x8B5E; - const unsigned int SAMPLER_CUBE = 0x8B60; - - /* Vertex Arrays */ - const unsigned int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; - const unsigned int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; - const unsigned int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; - const unsigned int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; - const unsigned int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; - const unsigned int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; - const unsigned int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; - - /* Shader Source */ - const unsigned int COMPILE_STATUS = 0x8B81; - - /* Shader Precision-Specified Types */ - const unsigned int LOW_FLOAT = 0x8DF0; - const unsigned int MEDIUM_FLOAT = 0x8DF1; - const unsigned int HIGH_FLOAT = 0x8DF2; - const unsigned int LOW_INT = 0x8DF3; - const unsigned int MEDIUM_INT = 0x8DF4; - const unsigned int HIGH_INT = 0x8DF5; - - /* Framebuffer Object. */ - const unsigned int FRAMEBUFFER = 0x8D40; - const unsigned int RENDERBUFFER = 0x8D41; - - const unsigned int RGBA4 = 0x8056; - const unsigned int RGB5_A1 = 0x8057; - const unsigned int RGB565 = 0x8D62; - const unsigned int DEPTH_COMPONENT16 = 0x81A5; - const unsigned int STENCIL_INDEX = 0x1901; - const unsigned int STENCIL_INDEX8 = 0x8D48; - const unsigned int DEPTH_STENCIL = 0x84F9; - - const unsigned int RENDERBUFFER_WIDTH = 0x8D42; - const unsigned int RENDERBUFFER_HEIGHT = 0x8D43; - const unsigned int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; - const unsigned int RENDERBUFFER_RED_SIZE = 0x8D50; - const unsigned int RENDERBUFFER_GREEN_SIZE = 0x8D51; - const unsigned int RENDERBUFFER_BLUE_SIZE = 0x8D52; - const unsigned int RENDERBUFFER_ALPHA_SIZE = 0x8D53; - const unsigned int RENDERBUFFER_DEPTH_SIZE = 0x8D54; - const unsigned int RENDERBUFFER_STENCIL_SIZE = 0x8D55; - - const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; - const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; - const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; - const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; - - const unsigned int COLOR_ATTACHMENT0 = 0x8CE0; - const unsigned int DEPTH_ATTACHMENT = 0x8D00; - const unsigned int STENCIL_ATTACHMENT = 0x8D20; - const unsigned int DEPTH_STENCIL_ATTACHMENT = 0x821A; - - const unsigned int NONE = 0; - - const unsigned int FRAMEBUFFER_COMPLETE = 0x8CD5; - const unsigned int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; - const unsigned int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; - const unsigned int FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; - const unsigned int FRAMEBUFFER_UNSUPPORTED = 0x8CDD; - - const unsigned int FRAMEBUFFER_BINDING = 0x8CA6; - const unsigned int RENDERBUFFER_BINDING = 0x8CA7; - const unsigned int MAX_RENDERBUFFER_SIZE = 0x84E8; - - const unsigned int INVALID_FRAMEBUFFER_OPERATION = 0x0506; - - /* WebGL-specific enums */ - const unsigned int UNPACK_FLIP_Y_WEBGL = 0x9240; - const unsigned int UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; - const unsigned int CONTEXT_LOST_WEBGL = 0x9242; - const unsigned int UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; - const unsigned int BROWSER_DEFAULT_WEBGL = 0x9244; - - readonly attribute long drawingBufferWidth; - readonly attribute long drawingBufferHeight; - - [StrictTypeChecking] void activeTexture(in unsigned long texture) raises(DOMException); - [StrictTypeChecking] void attachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); - [StrictTypeChecking] void bindAttribLocation(in WebGLProgram program, in unsigned long index, in DOMString name) raises(DOMException); - [StrictTypeChecking] void bindBuffer(in unsigned long target, in WebGLBuffer buffer) raises(DOMException); - [StrictTypeChecking] void bindFramebuffer(in unsigned long target, in WebGLFramebuffer framebuffer) raises(DOMException); - [StrictTypeChecking] void bindRenderbuffer(in unsigned long target, in WebGLRenderbuffer renderbuffer) raises(DOMException); - [StrictTypeChecking] void bindTexture(in unsigned long target, in WebGLTexture texture) raises(DOMException); - [StrictTypeChecking] void blendColor(in float red, in float green, in float blue, in float alpha); - [StrictTypeChecking] void blendEquation( in unsigned long mode ); - [StrictTypeChecking] void blendEquationSeparate(in unsigned long modeRGB, in unsigned long modeAlpha); - [StrictTypeChecking] void blendFunc(in unsigned long sfactor, in unsigned long dfactor); - [StrictTypeChecking] void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); - [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBuffer? data, in unsigned long usage) raises (DOMException); - [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBufferView? data, in unsigned long usage) raises (DOMException); - [StrictTypeChecking] void bufferData(in unsigned long target, in long long size, in unsigned long usage) raises (DOMException); - [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBuffer? data) raises (DOMException); - [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBufferView? data) raises (DOMException); - - [StrictTypeChecking] unsigned long checkFramebufferStatus(in unsigned long target); - [StrictTypeChecking] void clear(in unsigned long mask); - [StrictTypeChecking] void clearColor(in float red, in float green, in float blue, in float alpha); - [StrictTypeChecking] void clearDepth(in float depth); - [StrictTypeChecking] void clearStencil(in long s); - [StrictTypeChecking] void colorMask(in boolean red, in boolean green, in boolean blue, in boolean alpha); - [StrictTypeChecking] void compileShader(in WebGLShader shader) raises(DOMException); - - [StrictTypeChecking] void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in long width, in long height, in long border, in ArrayBufferView data); - [StrictTypeChecking] void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in long width, in long height, in unsigned long format, in ArrayBufferView data); - - [StrictTypeChecking] void copyTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long x, in long y, in long width, in long height, in long border); - [StrictTypeChecking] void copyTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long x, in long y, in long width, in long height); - - [StrictTypeChecking] WebGLBuffer createBuffer(); - [StrictTypeChecking] WebGLFramebuffer createFramebuffer(); - [StrictTypeChecking] WebGLProgram createProgram(); - [StrictTypeChecking] WebGLRenderbuffer createRenderbuffer(); - [StrictTypeChecking] WebGLShader createShader(in unsigned long type) raises(DOMException); - [StrictTypeChecking] WebGLTexture createTexture(); - - [StrictTypeChecking] void cullFace(in unsigned long mode); - - [StrictTypeChecking] void deleteBuffer(in WebGLBuffer buffer); - [StrictTypeChecking] void deleteFramebuffer(in WebGLFramebuffer framebuffer); - [StrictTypeChecking] void deleteProgram(in WebGLProgram program); - [StrictTypeChecking] void deleteRenderbuffer(in WebGLRenderbuffer renderbuffer); - [StrictTypeChecking] void deleteShader(in WebGLShader shader); - [StrictTypeChecking] void deleteTexture(in WebGLTexture texture); - - [StrictTypeChecking] void depthFunc(in unsigned long func); - [StrictTypeChecking] void depthMask(in boolean flag); - // FIXME: this differs from the current WebGL spec (depthRangef) - [StrictTypeChecking] void depthRange(in float zNear, in float zFar); - [StrictTypeChecking] void detachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); - [StrictTypeChecking] void disable(in unsigned long cap); - [StrictTypeChecking] void disableVertexAttribArray(in unsigned long index) raises(DOMException); - [StrictTypeChecking] void drawArrays(in unsigned long mode, in long first, in long count) raises(DOMException); - [StrictTypeChecking] void drawElements(in unsigned long mode, in long count, in unsigned long type, in long long offset) raises(DOMException); - - [StrictTypeChecking] void enable(in unsigned long cap); - [StrictTypeChecking] void enableVertexAttribArray(in unsigned long index) raises(DOMException); - [StrictTypeChecking] void finish(); - [StrictTypeChecking] void flush(); - [StrictTypeChecking] void framebufferRenderbuffer(in unsigned long target, in unsigned long attachment, in unsigned long renderbuffertarget, in WebGLRenderbuffer renderbuffer) raises(DOMException); - [StrictTypeChecking] void framebufferTexture2D(in unsigned long target, in unsigned long attachment, in unsigned long textarget, in WebGLTexture texture, in long level) raises(DOMException); - [StrictTypeChecking] void frontFace(in unsigned long mode); - [StrictTypeChecking] void generateMipmap(in unsigned long target); - - [StrictTypeChecking] WebGLActiveInfo getActiveAttrib(in WebGLProgram program, in unsigned long index) raises (DOMException); - [StrictTypeChecking] WebGLActiveInfo getActiveUniform(in WebGLProgram program, in unsigned long index) raises (DOMException); - - [StrictTypeChecking, Custom] void getAttachedShaders(in WebGLProgram program) raises (DOMException); - - [StrictTypeChecking] int getAttribLocation(in WebGLProgram program, in DOMString name); - - // any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getBufferParameter(); - - [StrictTypeChecking] WebGLContextAttributes getContextAttributes(); - - [StrictTypeChecking] unsigned long getError(); - - // object getExtension(in DOMString name); - [StrictTypeChecking, Custom] void getExtension(in DOMString name); - - // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getFramebufferAttachmentParameter(); - // any getParameter(in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getParameter(); - // any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getProgramParameter(); - [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException); - // any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getRenderbufferParameter(); - // any getShaderParameter(in WebGLShader shader, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getShaderParameter() raises(DOMException); - - [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getShaderInfoLog(in WebGLShader shader) raises(DOMException); - - [StrictTypeChecking] WebGLShaderPrecisionFormat getShaderPrecisionFormat(in unsigned long shadertype, in unsigned long precisiontype) raises(DOMException); - - [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getShaderSource(in WebGLShader shader) raises(DOMException); - - // DOMString[] getSupportedExtensions() - [StrictTypeChecking, Custom] void getSupportedExtensions(); - - // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getTexParameter(); - - // any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException); - [StrictTypeChecking, Custom] void getUniform(); - - [StrictTypeChecking] WebGLUniformLocation getUniformLocation(in WebGLProgram program, in DOMString name) raises(DOMException); - - // any getVertexAttrib(in unsigned long index, in unsigned long pname) raises(DOMException); - [StrictTypeChecking, Custom] void getVertexAttrib(); - - [StrictTypeChecking] long long getVertexAttribOffset(in unsigned long index, in unsigned long pname); - - [StrictTypeChecking] void hint(in unsigned long target, in unsigned long mode); - [StrictTypeChecking] boolean isBuffer(in WebGLBuffer buffer); - [StrictTypeChecking] boolean isContextLost(); - [StrictTypeChecking] boolean isEnabled(in unsigned long cap); - [StrictTypeChecking] boolean isFramebuffer(in WebGLFramebuffer framebuffer); - [StrictTypeChecking] boolean isProgram(in WebGLProgram program); - [StrictTypeChecking] boolean isRenderbuffer(in WebGLRenderbuffer renderbuffer); - [StrictTypeChecking] boolean isShader(in WebGLShader shader); - [StrictTypeChecking] boolean isTexture(in WebGLTexture texture); - [StrictTypeChecking] void lineWidth(in float width); - [StrictTypeChecking] void linkProgram(in WebGLProgram program) raises(DOMException); - [StrictTypeChecking] void pixelStorei(in unsigned long pname, in long param); - [StrictTypeChecking] void polygonOffset(in float factor, in float units); - - [StrictTypeChecking] void readPixels(in long x, in long y, in long width, in long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises(DOMException); - - [StrictTypeChecking] void releaseShaderCompiler(); - [StrictTypeChecking] void renderbufferStorage(in unsigned long target, in unsigned long internalformat, in long width, in long height); - [StrictTypeChecking] void sampleCoverage(in float value, in boolean invert); - [StrictTypeChecking] void scissor(in long x, in long y, in long width, in long height); - [StrictTypeChecking] void shaderSource(in WebGLShader shader, in DOMString string) raises(DOMException); - [StrictTypeChecking] void stencilFunc(in unsigned long func, in long ref, in unsigned long mask); - [StrictTypeChecking] void stencilFuncSeparate(in unsigned long face, in unsigned long func, in long ref, in unsigned long mask); - [StrictTypeChecking] void stencilMask(in unsigned long mask); - [StrictTypeChecking] void stencilMaskSeparate(in unsigned long face, in unsigned long mask); - [StrictTypeChecking] void stencilOp(in unsigned long fail, in unsigned long zfail, in unsigned long zpass); - [StrictTypeChecking] void stencilOpSeparate(in unsigned long face, in unsigned long fail, in unsigned long zfail, in unsigned long zpass); - - [StrictTypeChecking] void texParameterf(in unsigned long target, in unsigned long pname, in float param); - [StrictTypeChecking] void texParameteri(in unsigned long target, in unsigned long pname, in long param); - - // Supported forms: - [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long width, in long height, - in long border, in unsigned long format, in unsigned long type, in ArrayBufferView? pixels) raises (DOMException); - [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in ImageData? pixels) raises (DOMException); - [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in HTMLImageElement? image) raises (DOMException); - [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in HTMLCanvasElement? canvas) raises (DOMException); +[ + Conditional=WEBGL, + JSCustomMarkFunction, + DoNotCheckConstants +] interface WebGLRenderingContext : CanvasRenderingContext { + + /* ClearBufferMask */ + const unsigned int DEPTH_BUFFER_BIT = 0x00000100; + const unsigned int STENCIL_BUFFER_BIT = 0x00000400; + const unsigned int COLOR_BUFFER_BIT = 0x00004000; + + /* BeginMode */ + const unsigned int POINTS = 0x0000; + const unsigned int LINES = 0x0001; + const unsigned int LINE_LOOP = 0x0002; + const unsigned int LINE_STRIP = 0x0003; + const unsigned int TRIANGLES = 0x0004; + const unsigned int TRIANGLE_STRIP = 0x0005; + const unsigned int TRIANGLE_FAN = 0x0006; + + /* AlphaFunction (not supported in ES20) */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* BlendingFactorDest */ + const unsigned int ZERO = 0; + const unsigned int ONE = 1; + const unsigned int SRC_COLOR = 0x0300; + const unsigned int ONE_MINUS_SRC_COLOR = 0x0301; + const unsigned int SRC_ALPHA = 0x0302; + const unsigned int ONE_MINUS_SRC_ALPHA = 0x0303; + const unsigned int DST_ALPHA = 0x0304; + const unsigned int ONE_MINUS_DST_ALPHA = 0x0305; + + /* BlendingFactorSrc */ + /* ZERO */ + /* ONE */ + const unsigned int DST_COLOR = 0x0306; + const unsigned int ONE_MINUS_DST_COLOR = 0x0307; + const unsigned int SRC_ALPHA_SATURATE = 0x0308; + /* SRC_ALPHA */ + /* ONE_MINUS_SRC_ALPHA */ + /* DST_ALPHA */ + /* ONE_MINUS_DST_ALPHA */ + + /* BlendEquationSeparate */ + const unsigned int FUNC_ADD = 0x8006; + const unsigned int BLEND_EQUATION = 0x8009; + const unsigned int BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */ + const unsigned int BLEND_EQUATION_ALPHA = 0x883D; + + /* BlendSubtract */ + const unsigned int FUNC_SUBTRACT = 0x800A; + const unsigned int FUNC_REVERSE_SUBTRACT = 0x800B; + + /* Separate Blend Functions */ + const unsigned int BLEND_DST_RGB = 0x80C8; + const unsigned int BLEND_SRC_RGB = 0x80C9; + const unsigned int BLEND_DST_ALPHA = 0x80CA; + const unsigned int BLEND_SRC_ALPHA = 0x80CB; + const unsigned int CONSTANT_COLOR = 0x8001; + const unsigned int ONE_MINUS_CONSTANT_COLOR = 0x8002; + const unsigned int CONSTANT_ALPHA = 0x8003; + const unsigned int ONE_MINUS_CONSTANT_ALPHA = 0x8004; + const unsigned int BLEND_COLOR = 0x8005; + + /* Buffer Objects */ + const unsigned int ARRAY_BUFFER = 0x8892; + const unsigned int ELEMENT_ARRAY_BUFFER = 0x8893; + const unsigned int ARRAY_BUFFER_BINDING = 0x8894; + const unsigned int ELEMENT_ARRAY_BUFFER_BINDING = 0x8895; + + const unsigned int STREAM_DRAW = 0x88E0; + const unsigned int STATIC_DRAW = 0x88E4; + const unsigned int DYNAMIC_DRAW = 0x88E8; + + const unsigned int BUFFER_SIZE = 0x8764; + const unsigned int BUFFER_USAGE = 0x8765; + + const unsigned int CURRENT_VERTEX_ATTRIB = 0x8626; + + /* CullFaceMode */ + const unsigned int FRONT = 0x0404; + const unsigned int BACK = 0x0405; + const unsigned int FRONT_AND_BACK = 0x0408; + + /* DepthFunction */ + /* NEVER */ + /* LESS */ + /* EQUAL */ + /* LEQUAL */ + /* GREATER */ + /* NOTEQUAL */ + /* GEQUAL */ + /* ALWAYS */ + + /* EnableCap */ + const unsigned int TEXTURE_2D = 0x0DE1; + const unsigned int CULL_FACE = 0x0B44; + const unsigned int BLEND = 0x0BE2; + const unsigned int DITHER = 0x0BD0; + const unsigned int STENCIL_TEST = 0x0B90; + const unsigned int DEPTH_TEST = 0x0B71; + const unsigned int SCISSOR_TEST = 0x0C11; + const unsigned int POLYGON_OFFSET_FILL = 0x8037; + const unsigned int SAMPLE_ALPHA_TO_COVERAGE = 0x809E; + const unsigned int SAMPLE_COVERAGE = 0x80A0; + + /* ErrorCode */ + const unsigned int NO_ERROR = 0; + const unsigned int INVALID_ENUM = 0x0500; + const unsigned int INVALID_VALUE = 0x0501; + const unsigned int INVALID_OPERATION = 0x0502; + const unsigned int OUT_OF_MEMORY = 0x0505; + + /* FrontFaceDirection */ + const unsigned int CW = 0x0900; + const unsigned int CCW = 0x0901; + + /* GetPName */ + const unsigned int LINE_WIDTH = 0x0B21; + const unsigned int ALIASED_POINT_SIZE_RANGE = 0x846D; + const unsigned int ALIASED_LINE_WIDTH_RANGE = 0x846E; + const unsigned int CULL_FACE_MODE = 0x0B45; + const unsigned int FRONT_FACE = 0x0B46; + const unsigned int DEPTH_RANGE = 0x0B70; + const unsigned int DEPTH_WRITEMASK = 0x0B72; + const unsigned int DEPTH_CLEAR_VALUE = 0x0B73; + const unsigned int DEPTH_FUNC = 0x0B74; + const unsigned int STENCIL_CLEAR_VALUE = 0x0B91; + const unsigned int STENCIL_FUNC = 0x0B92; + const unsigned int STENCIL_FAIL = 0x0B94; + const unsigned int STENCIL_PASS_DEPTH_FAIL = 0x0B95; + const unsigned int STENCIL_PASS_DEPTH_PASS = 0x0B96; + const unsigned int STENCIL_REF = 0x0B97; + const unsigned int STENCIL_VALUE_MASK = 0x0B93; + const unsigned int STENCIL_WRITEMASK = 0x0B98; + const unsigned int STENCIL_BACK_FUNC = 0x8800; + const unsigned int STENCIL_BACK_FAIL = 0x8801; + const unsigned int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + const unsigned int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + const unsigned int STENCIL_BACK_REF = 0x8CA3; + const unsigned int STENCIL_BACK_VALUE_MASK = 0x8CA4; + const unsigned int STENCIL_BACK_WRITEMASK = 0x8CA5; + const unsigned int VIEWPORT = 0x0BA2; + const unsigned int SCISSOR_BOX = 0x0C10; + /* SCISSOR_TEST */ + const unsigned int COLOR_CLEAR_VALUE = 0x0C22; + const unsigned int COLOR_WRITEMASK = 0x0C23; + const unsigned int UNPACK_ALIGNMENT = 0x0CF5; + const unsigned int PACK_ALIGNMENT = 0x0D05; + const unsigned int MAX_TEXTURE_SIZE = 0x0D33; + const unsigned int MAX_VIEWPORT_DIMS = 0x0D3A; + const unsigned int SUBPIXEL_BITS = 0x0D50; + const unsigned int RED_BITS = 0x0D52; + const unsigned int GREEN_BITS = 0x0D53; + const unsigned int BLUE_BITS = 0x0D54; + const unsigned int ALPHA_BITS = 0x0D55; + const unsigned int DEPTH_BITS = 0x0D56; + const unsigned int STENCIL_BITS = 0x0D57; + const unsigned int POLYGON_OFFSET_UNITS = 0x2A00; + /* POLYGON_OFFSET_FILL */ + const unsigned int POLYGON_OFFSET_FACTOR = 0x8038; + const unsigned int TEXTURE_BINDING_2D = 0x8069; + const unsigned int SAMPLE_BUFFERS = 0x80A8; + const unsigned int SAMPLES = 0x80A9; + const unsigned int SAMPLE_COVERAGE_VALUE = 0x80AA; + const unsigned int SAMPLE_COVERAGE_INVERT = 0x80AB; + + /* GetTextureParameter */ + /* TEXTURE_MAG_FILTER */ + /* TEXTURE_MIN_FILTER */ + /* TEXTURE_WRAP_S */ + /* TEXTURE_WRAP_T */ + + const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3; + + /* HintMode */ + const unsigned int DONT_CARE = 0x1100; + const unsigned int FASTEST = 0x1101; + const unsigned int NICEST = 0x1102; + + /* HintTarget */ + const unsigned int GENERATE_MIPMAP_HINT = 0x8192; + + /* DataType */ + const unsigned int BYTE = 0x1400; + const unsigned int UNSIGNED_BYTE = 0x1401; + const unsigned int SHORT = 0x1402; + const unsigned int UNSIGNED_SHORT = 0x1403; + const unsigned int INT = 0x1404; + const unsigned int UNSIGNED_INT = 0x1405; + const unsigned int FLOAT = 0x1406; + + /* PixelFormat */ + const unsigned int DEPTH_COMPONENT = 0x1902; + const unsigned int ALPHA = 0x1906; + const unsigned int RGB = 0x1907; + const unsigned int RGBA = 0x1908; + const unsigned int LUMINANCE = 0x1909; + const unsigned int LUMINANCE_ALPHA = 0x190A; + + /* PixelType */ + /* UNSIGNED_BYTE */ + const unsigned int UNSIGNED_SHORT_4_4_4_4 = 0x8033; + const unsigned int UNSIGNED_SHORT_5_5_5_1 = 0x8034; + const unsigned int UNSIGNED_SHORT_5_6_5 = 0x8363; + + /* Shaders */ + const unsigned int FRAGMENT_SHADER = 0x8B30; + const unsigned int VERTEX_SHADER = 0x8B31; + const unsigned int MAX_VERTEX_ATTRIBS = 0x8869; + const unsigned int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + const unsigned int MAX_VARYING_VECTORS = 0x8DFC; + const unsigned int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + const unsigned int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + const unsigned int MAX_TEXTURE_IMAGE_UNITS = 0x8872; + const unsigned int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + const unsigned int SHADER_TYPE = 0x8B4F; + const unsigned int DELETE_STATUS = 0x8B80; + const unsigned int LINK_STATUS = 0x8B82; + const unsigned int VALIDATE_STATUS = 0x8B83; + const unsigned int ATTACHED_SHADERS = 0x8B85; + const unsigned int ACTIVE_UNIFORMS = 0x8B86; + const unsigned int ACTIVE_ATTRIBUTES = 0x8B89; + const unsigned int SHADING_LANGUAGE_VERSION = 0x8B8C; + const unsigned int CURRENT_PROGRAM = 0x8B8D; + + /* StencilFunction */ + const unsigned int NEVER = 0x0200; + const unsigned int LESS = 0x0201; + const unsigned int EQUAL = 0x0202; + const unsigned int LEQUAL = 0x0203; + const unsigned int GREATER = 0x0204; + const unsigned int NOTEQUAL = 0x0205; + const unsigned int GEQUAL = 0x0206; + const unsigned int ALWAYS = 0x0207; + + /* StencilOp */ + /* ZERO */ + const unsigned int KEEP = 0x1E00; + const unsigned int REPLACE = 0x1E01; + const unsigned int INCR = 0x1E02; + const unsigned int DECR = 0x1E03; + const unsigned int INVERT = 0x150A; + const unsigned int INCR_WRAP = 0x8507; + const unsigned int DECR_WRAP = 0x8508; + + /* StringName */ + const unsigned int VENDOR = 0x1F00; + const unsigned int RENDERER = 0x1F01; + const unsigned int VERSION = 0x1F02; + + /* TextureMagFilter */ + const unsigned int NEAREST = 0x2600; + const unsigned int LINEAR = 0x2601; + + /* TextureMinFilter */ + /* NEAREST */ + /* LINEAR */ + const unsigned int NEAREST_MIPMAP_NEAREST = 0x2700; + const unsigned int LINEAR_MIPMAP_NEAREST = 0x2701; + const unsigned int NEAREST_MIPMAP_LINEAR = 0x2702; + const unsigned int LINEAR_MIPMAP_LINEAR = 0x2703; + + /* TextureParameterName */ + const unsigned int TEXTURE_MAG_FILTER = 0x2800; + const unsigned int TEXTURE_MIN_FILTER = 0x2801; + const unsigned int TEXTURE_WRAP_S = 0x2802; + const unsigned int TEXTURE_WRAP_T = 0x2803; + + /* TextureTarget */ + /* TEXTURE_2D */ + const unsigned int TEXTURE = 0x1702; + + const unsigned int TEXTURE_CUBE_MAP = 0x8513; + const unsigned int TEXTURE_BINDING_CUBE_MAP = 0x8514; + const unsigned int TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; + const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516; + const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517; + const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518; + const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519; + const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A; + const unsigned int MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + + /* TextureUnit */ + const unsigned int TEXTURE0 = 0x84C0; + const unsigned int TEXTURE1 = 0x84C1; + const unsigned int TEXTURE2 = 0x84C2; + const unsigned int TEXTURE3 = 0x84C3; + const unsigned int TEXTURE4 = 0x84C4; + const unsigned int TEXTURE5 = 0x84C5; + const unsigned int TEXTURE6 = 0x84C6; + const unsigned int TEXTURE7 = 0x84C7; + const unsigned int TEXTURE8 = 0x84C8; + const unsigned int TEXTURE9 = 0x84C9; + const unsigned int TEXTURE10 = 0x84CA; + const unsigned int TEXTURE11 = 0x84CB; + const unsigned int TEXTURE12 = 0x84CC; + const unsigned int TEXTURE13 = 0x84CD; + const unsigned int TEXTURE14 = 0x84CE; + const unsigned int TEXTURE15 = 0x84CF; + const unsigned int TEXTURE16 = 0x84D0; + const unsigned int TEXTURE17 = 0x84D1; + const unsigned int TEXTURE18 = 0x84D2; + const unsigned int TEXTURE19 = 0x84D3; + const unsigned int TEXTURE20 = 0x84D4; + const unsigned int TEXTURE21 = 0x84D5; + const unsigned int TEXTURE22 = 0x84D6; + const unsigned int TEXTURE23 = 0x84D7; + const unsigned int TEXTURE24 = 0x84D8; + const unsigned int TEXTURE25 = 0x84D9; + const unsigned int TEXTURE26 = 0x84DA; + const unsigned int TEXTURE27 = 0x84DB; + const unsigned int TEXTURE28 = 0x84DC; + const unsigned int TEXTURE29 = 0x84DD; + const unsigned int TEXTURE30 = 0x84DE; + const unsigned int TEXTURE31 = 0x84DF; + const unsigned int ACTIVE_TEXTURE = 0x84E0; + + /* TextureWrapMode */ + const unsigned int REPEAT = 0x2901; + const unsigned int CLAMP_TO_EDGE = 0x812F; + const unsigned int MIRRORED_REPEAT = 0x8370; + + /* Uniform Types */ + const unsigned int FLOAT_VEC2 = 0x8B50; + const unsigned int FLOAT_VEC3 = 0x8B51; + const unsigned int FLOAT_VEC4 = 0x8B52; + const unsigned int INT_VEC2 = 0x8B53; + const unsigned int INT_VEC3 = 0x8B54; + const unsigned int INT_VEC4 = 0x8B55; + const unsigned int BOOL = 0x8B56; + const unsigned int BOOL_VEC2 = 0x8B57; + const unsigned int BOOL_VEC3 = 0x8B58; + const unsigned int BOOL_VEC4 = 0x8B59; + const unsigned int FLOAT_MAT2 = 0x8B5A; + const unsigned int FLOAT_MAT3 = 0x8B5B; + const unsigned int FLOAT_MAT4 = 0x8B5C; + const unsigned int SAMPLER_2D = 0x8B5E; + const unsigned int SAMPLER_CUBE = 0x8B60; + + /* Vertex Arrays */ + const unsigned int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + const unsigned int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + const unsigned int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + const unsigned int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + const unsigned int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + const unsigned int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + const unsigned int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + + /* Shader Source */ + const unsigned int COMPILE_STATUS = 0x8B81; + + /* Shader Precision-Specified Types */ + const unsigned int LOW_FLOAT = 0x8DF0; + const unsigned int MEDIUM_FLOAT = 0x8DF1; + const unsigned int HIGH_FLOAT = 0x8DF2; + const unsigned int LOW_INT = 0x8DF3; + const unsigned int MEDIUM_INT = 0x8DF4; + const unsigned int HIGH_INT = 0x8DF5; + + /* Framebuffer Object. */ + const unsigned int FRAMEBUFFER = 0x8D40; + const unsigned int RENDERBUFFER = 0x8D41; + + const unsigned int RGBA4 = 0x8056; + const unsigned int RGB5_A1 = 0x8057; + const unsigned int RGB565 = 0x8D62; + const unsigned int DEPTH_COMPONENT16 = 0x81A5; + const unsigned int STENCIL_INDEX = 0x1901; + const unsigned int STENCIL_INDEX8 = 0x8D48; + const unsigned int DEPTH_STENCIL = 0x84F9; + + const unsigned int RENDERBUFFER_WIDTH = 0x8D42; + const unsigned int RENDERBUFFER_HEIGHT = 0x8D43; + const unsigned int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + const unsigned int RENDERBUFFER_RED_SIZE = 0x8D50; + const unsigned int RENDERBUFFER_GREEN_SIZE = 0x8D51; + const unsigned int RENDERBUFFER_BLUE_SIZE = 0x8D52; + const unsigned int RENDERBUFFER_ALPHA_SIZE = 0x8D53; + const unsigned int RENDERBUFFER_DEPTH_SIZE = 0x8D54; + const unsigned int RENDERBUFFER_STENCIL_SIZE = 0x8D55; + + const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + + const unsigned int COLOR_ATTACHMENT0 = 0x8CE0; + const unsigned int DEPTH_ATTACHMENT = 0x8D00; + const unsigned int STENCIL_ATTACHMENT = 0x8D20; + const unsigned int DEPTH_STENCIL_ATTACHMENT = 0x821A; + + const unsigned int NONE = 0; + + const unsigned int FRAMEBUFFER_COMPLETE = 0x8CD5; + const unsigned int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + const unsigned int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + const unsigned int FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9; + const unsigned int FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + + const unsigned int FRAMEBUFFER_BINDING = 0x8CA6; + const unsigned int RENDERBUFFER_BINDING = 0x8CA7; + const unsigned int MAX_RENDERBUFFER_SIZE = 0x84E8; + + const unsigned int INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + /* WebGL-specific enums */ + const unsigned int UNPACK_FLIP_Y_WEBGL = 0x9240; + const unsigned int UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241; + const unsigned int CONTEXT_LOST_WEBGL = 0x9242; + const unsigned int UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243; + const unsigned int BROWSER_DEFAULT_WEBGL = 0x9244; + + readonly attribute long drawingBufferWidth; + readonly attribute long drawingBufferHeight; + + [StrictTypeChecking] void activeTexture(in unsigned long texture) raises(DOMException); + [StrictTypeChecking] void attachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); + [StrictTypeChecking] void bindAttribLocation(in WebGLProgram program, in unsigned long index, in DOMString name) raises(DOMException); + [StrictTypeChecking] void bindBuffer(in unsigned long target, in WebGLBuffer buffer) raises(DOMException); + [StrictTypeChecking] void bindFramebuffer(in unsigned long target, in WebGLFramebuffer framebuffer) raises(DOMException); + [StrictTypeChecking] void bindRenderbuffer(in unsigned long target, in WebGLRenderbuffer renderbuffer) raises(DOMException); + [StrictTypeChecking] void bindTexture(in unsigned long target, in WebGLTexture texture) raises(DOMException); + [StrictTypeChecking] void blendColor(in float red, in float green, in float blue, in float alpha); + [StrictTypeChecking] void blendEquation( in unsigned long mode ); + [StrictTypeChecking] void blendEquationSeparate(in unsigned long modeRGB, in unsigned long modeAlpha); + [StrictTypeChecking] void blendFunc(in unsigned long sfactor, in unsigned long dfactor); + [StrictTypeChecking] void blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha); + [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBuffer? data, in unsigned long usage) raises (DOMException); + [StrictTypeChecking] void bufferData(in unsigned long target, in ArrayBufferView? data, in unsigned long usage) raises (DOMException); + [StrictTypeChecking] void bufferData(in unsigned long target, in long long size, in unsigned long usage) raises (DOMException); + [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBuffer? data) raises (DOMException); + [StrictTypeChecking] void bufferSubData(in unsigned long target, in long long offset, in ArrayBufferView? data) raises (DOMException); + + [StrictTypeChecking] unsigned long checkFramebufferStatus(in unsigned long target); + [StrictTypeChecking] void clear(in unsigned long mask); + [StrictTypeChecking] void clearColor(in float red, in float green, in float blue, in float alpha); + [StrictTypeChecking] void clearDepth(in float depth); + [StrictTypeChecking] void clearStencil(in long s); + [StrictTypeChecking] void colorMask(in boolean red, in boolean green, in boolean blue, in boolean alpha); + [StrictTypeChecking] void compileShader(in WebGLShader shader) raises(DOMException); + + [StrictTypeChecking] void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in long width, in long height, in long border, in ArrayBufferView data); + [StrictTypeChecking] void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in long width, in long height, in unsigned long format, in ArrayBufferView data); + + [StrictTypeChecking] void copyTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long x, in long y, in long width, in long height, in long border); + [StrictTypeChecking] void copyTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long x, in long y, in long width, in long height); + + [StrictTypeChecking] WebGLBuffer createBuffer(); + [StrictTypeChecking] WebGLFramebuffer createFramebuffer(); + [StrictTypeChecking] WebGLProgram createProgram(); + [StrictTypeChecking] WebGLRenderbuffer createRenderbuffer(); + [StrictTypeChecking] WebGLShader createShader(in unsigned long type) raises(DOMException); + [StrictTypeChecking] WebGLTexture createTexture(); + + [StrictTypeChecking] void cullFace(in unsigned long mode); + + [StrictTypeChecking] void deleteBuffer(in WebGLBuffer buffer); + [StrictTypeChecking] void deleteFramebuffer(in WebGLFramebuffer framebuffer); + [StrictTypeChecking] void deleteProgram(in WebGLProgram program); + [StrictTypeChecking] void deleteRenderbuffer(in WebGLRenderbuffer renderbuffer); + [StrictTypeChecking] void deleteShader(in WebGLShader shader); + [StrictTypeChecking] void deleteTexture(in WebGLTexture texture); + + [StrictTypeChecking] void depthFunc(in unsigned long func); + [StrictTypeChecking] void depthMask(in boolean flag); + // FIXME: this differs from the current WebGL spec (depthRangef) + [StrictTypeChecking] void depthRange(in float zNear, in float zFar); + [StrictTypeChecking] void detachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException); + [StrictTypeChecking] void disable(in unsigned long cap); + [StrictTypeChecking] void disableVertexAttribArray(in unsigned long index) raises(DOMException); + [StrictTypeChecking] void drawArrays(in unsigned long mode, in long first, in long count) raises(DOMException); + [StrictTypeChecking] void drawElements(in unsigned long mode, in long count, in unsigned long type, in long long offset) raises(DOMException); + + [StrictTypeChecking] void enable(in unsigned long cap); + [StrictTypeChecking] void enableVertexAttribArray(in unsigned long index) raises(DOMException); + [StrictTypeChecking] void finish(); + [StrictTypeChecking] void flush(); + [StrictTypeChecking] void framebufferRenderbuffer(in unsigned long target, in unsigned long attachment, in unsigned long renderbuffertarget, in WebGLRenderbuffer renderbuffer) raises(DOMException); + [StrictTypeChecking] void framebufferTexture2D(in unsigned long target, in unsigned long attachment, in unsigned long textarget, in WebGLTexture texture, in long level) raises(DOMException); + [StrictTypeChecking] void frontFace(in unsigned long mode); + [StrictTypeChecking] void generateMipmap(in unsigned long target); + + [StrictTypeChecking] WebGLActiveInfo getActiveAttrib(in WebGLProgram program, in unsigned long index) raises (DOMException); + [StrictTypeChecking] WebGLActiveInfo getActiveUniform(in WebGLProgram program, in unsigned long index) raises (DOMException); + + [StrictTypeChecking, Custom] void getAttachedShaders(in WebGLProgram program) raises (DOMException); + + [StrictTypeChecking] int getAttribLocation(in WebGLProgram program, in DOMString name); + + // any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getBufferParameter(); + + [StrictTypeChecking] WebGLContextAttributes getContextAttributes(); + + [StrictTypeChecking] unsigned long getError(); + + // object getExtension(in DOMString name); + [StrictTypeChecking, Custom] void getExtension(in DOMString name); + + // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getFramebufferAttachmentParameter(); + // any getParameter(in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getParameter(); + // any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getProgramParameter(); + [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException); + // any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getRenderbufferParameter(); + // any getShaderParameter(in WebGLShader shader, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getShaderParameter() raises(DOMException); + + [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getShaderInfoLog(in WebGLShader shader) raises(DOMException); + + [StrictTypeChecking] WebGLShaderPrecisionFormat getShaderPrecisionFormat(in unsigned long shadertype, in unsigned long precisiontype) raises(DOMException); + + [StrictTypeChecking, TreatReturnedNullStringAs=Null] DOMString getShaderSource(in WebGLShader shader) raises(DOMException); + + // DOMString[] getSupportedExtensions() + [StrictTypeChecking, Custom] void getSupportedExtensions(); + + // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getTexParameter(); + + // any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException); + [StrictTypeChecking, Custom] void getUniform(); + + [StrictTypeChecking] WebGLUniformLocation getUniformLocation(in WebGLProgram program, in DOMString name) raises(DOMException); + + // any getVertexAttrib(in unsigned long index, in unsigned long pname) raises(DOMException); + [StrictTypeChecking, Custom] void getVertexAttrib(); + + [StrictTypeChecking] long long getVertexAttribOffset(in unsigned long index, in unsigned long pname); + + [StrictTypeChecking] void hint(in unsigned long target, in unsigned long mode); + [StrictTypeChecking] boolean isBuffer(in WebGLBuffer buffer); + [StrictTypeChecking] boolean isContextLost(); + [StrictTypeChecking] boolean isEnabled(in unsigned long cap); + [StrictTypeChecking] boolean isFramebuffer(in WebGLFramebuffer framebuffer); + [StrictTypeChecking] boolean isProgram(in WebGLProgram program); + [StrictTypeChecking] boolean isRenderbuffer(in WebGLRenderbuffer renderbuffer); + [StrictTypeChecking] boolean isShader(in WebGLShader shader); + [StrictTypeChecking] boolean isTexture(in WebGLTexture texture); + [StrictTypeChecking] void lineWidth(in float width); + [StrictTypeChecking] void linkProgram(in WebGLProgram program) raises(DOMException); + [StrictTypeChecking] void pixelStorei(in unsigned long pname, in long param); + [StrictTypeChecking] void polygonOffset(in float factor, in float units); + + [StrictTypeChecking] void readPixels(in long x, in long y, in long width, in long height, in unsigned long format, in unsigned long type, in ArrayBufferView pixels) raises(DOMException); + + [StrictTypeChecking] void releaseShaderCompiler(); + [StrictTypeChecking] void renderbufferStorage(in unsigned long target, in unsigned long internalformat, in long width, in long height); + [StrictTypeChecking] void sampleCoverage(in float value, in boolean invert); + [StrictTypeChecking] void scissor(in long x, in long y, in long width, in long height); + [StrictTypeChecking] void shaderSource(in WebGLShader shader, in DOMString string) raises(DOMException); + [StrictTypeChecking] void stencilFunc(in unsigned long func, in long ref, in unsigned long mask); + [StrictTypeChecking] void stencilFuncSeparate(in unsigned long face, in unsigned long func, in long ref, in unsigned long mask); + [StrictTypeChecking] void stencilMask(in unsigned long mask); + [StrictTypeChecking] void stencilMaskSeparate(in unsigned long face, in unsigned long mask); + [StrictTypeChecking] void stencilOp(in unsigned long fail, in unsigned long zfail, in unsigned long zpass); + [StrictTypeChecking] void stencilOpSeparate(in unsigned long face, in unsigned long fail, in unsigned long zfail, in unsigned long zpass); + + [StrictTypeChecking] void texParameterf(in unsigned long target, in unsigned long pname, in float param); + [StrictTypeChecking] void texParameteri(in unsigned long target, in unsigned long pname, in long param); + + // Supported forms: + [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long width, in long height, + in long border, in unsigned long format, in unsigned long type, in ArrayBufferView? pixels) raises (DOMException); + [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in ImageData? pixels) raises (DOMException); + [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in HTMLImageElement? image) raises (DOMException); + [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in HTMLCanvasElement? canvas) raises (DOMException); #if defined(ENABLE_VIDEO) && ENABLE_VIDEO - [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in unsigned long format, in unsigned long type, in HTMLVideoElement? video) raises (DOMException); + [StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat, + in unsigned long format, in unsigned long type, in HTMLVideoElement? video) raises (DOMException); #endif - [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in long width, in long height, - in unsigned long format, in unsigned long type, in ArrayBufferView? pixels) raises (DOMException); - [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in ImageData? pixels) raises (DOMException); - [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in HTMLImageElement? image) raises (DOMException); - [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in HTMLCanvasElement? canvas) raises (DOMException); + [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in long width, in long height, + in unsigned long format, in unsigned long type, in ArrayBufferView? pixels) raises (DOMException); + [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in ImageData? pixels) raises (DOMException); + [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in HTMLImageElement? image) raises (DOMException); + [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in HTMLCanvasElement? canvas) raises (DOMException); #if defined(ENABLE_VIDEO) && ENABLE_VIDEO - [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in unsigned long format, in unsigned long type, in HTMLVideoElement? video) raises (DOMException); + [StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, + in unsigned long format, in unsigned long type, in HTMLVideoElement? video) raises (DOMException); #endif - [StrictTypeChecking] void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException); - [StrictTypeChecking, Custom] void uniform1fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); - [StrictTypeChecking] void uniform1i(in WebGLUniformLocation location, in long x) raises(DOMException); - [StrictTypeChecking, Custom] void uniform1iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); - [StrictTypeChecking] void uniform2f(in WebGLUniformLocation location, in float x, in float y) raises(DOMException); - [StrictTypeChecking, Custom] void uniform2fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); - [StrictTypeChecking] void uniform2i(in WebGLUniformLocation location, in long x, in long y) raises(DOMException); - [StrictTypeChecking, Custom] void uniform2iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); - [StrictTypeChecking] void uniform3f(in WebGLUniformLocation location, in float x, in float y, in float z) raises(DOMException); - [StrictTypeChecking, Custom] void uniform3fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); - [StrictTypeChecking] void uniform3i(in WebGLUniformLocation location, in long x, in long y, in long z) raises(DOMException); - [StrictTypeChecking, Custom] void uniform3iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); - [StrictTypeChecking] void uniform4f(in WebGLUniformLocation location, in float x, in float y, in float z, in float w) raises(DOMException); - [StrictTypeChecking, Custom] void uniform4fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); - [StrictTypeChecking] void uniform4i(in WebGLUniformLocation location, in long x, in long y, in long z, in long w) raises(DOMException); - [StrictTypeChecking, Custom] void uniform4iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); - - [StrictTypeChecking, Custom] void uniformMatrix2fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); - [StrictTypeChecking, Custom] void uniformMatrix3fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); - [StrictTypeChecking, Custom] void uniformMatrix4fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); - - [StrictTypeChecking] void useProgram(in WebGLProgram program) raises(DOMException); - [StrictTypeChecking] void validateProgram(in WebGLProgram program) raises(DOMException); - - [StrictTypeChecking] void vertexAttrib1f(in unsigned long indx, in float x); - [StrictTypeChecking, Custom] void vertexAttrib1fv(in unsigned long indx, in Float32Array values); - [StrictTypeChecking] void vertexAttrib2f(in unsigned long indx, in float x, in float y); - [StrictTypeChecking, Custom] void vertexAttrib2fv(in unsigned long indx, in Float32Array values); - [StrictTypeChecking] void vertexAttrib3f(in unsigned long indx, in float x, in float y, in float z); - [StrictTypeChecking, Custom] void vertexAttrib3fv(in unsigned long indx, in Float32Array values); - [StrictTypeChecking] void vertexAttrib4f(in unsigned long indx, in float x, in float y, in float z, in float w); - [StrictTypeChecking, Custom] void vertexAttrib4fv(in unsigned long indx, in Float32Array values); - [StrictTypeChecking] void vertexAttribPointer(in unsigned long indx, in long size, in unsigned long type, in boolean normalized, - in long stride, in long long offset) raises(DOMException); - - [StrictTypeChecking] void viewport(in long x, in long y, in long width, in long height); - }; -} - + [StrictTypeChecking] void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException); + [StrictTypeChecking, Custom] void uniform1fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); + [StrictTypeChecking] void uniform1i(in WebGLUniformLocation location, in long x) raises(DOMException); + [StrictTypeChecking, Custom] void uniform1iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); + [StrictTypeChecking] void uniform2f(in WebGLUniformLocation location, in float x, in float y) raises(DOMException); + [StrictTypeChecking, Custom] void uniform2fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); + [StrictTypeChecking] void uniform2i(in WebGLUniformLocation location, in long x, in long y) raises(DOMException); + [StrictTypeChecking, Custom] void uniform2iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); + [StrictTypeChecking] void uniform3f(in WebGLUniformLocation location, in float x, in float y, in float z) raises(DOMException); + [StrictTypeChecking, Custom] void uniform3fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); + [StrictTypeChecking] void uniform3i(in WebGLUniformLocation location, in long x, in long y, in long z) raises(DOMException); + [StrictTypeChecking, Custom] void uniform3iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); + [StrictTypeChecking] void uniform4f(in WebGLUniformLocation location, in float x, in float y, in float z, in float w) raises(DOMException); + [StrictTypeChecking, Custom] void uniform4fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException); + [StrictTypeChecking] void uniform4i(in WebGLUniformLocation location, in long x, in long y, in long z, in long w) raises(DOMException); + [StrictTypeChecking, Custom] void uniform4iv(in WebGLUniformLocation location, in Int32Array v) raises(DOMException); + + [StrictTypeChecking, Custom] void uniformMatrix2fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); + [StrictTypeChecking, Custom] void uniformMatrix3fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); + [StrictTypeChecking, Custom] void uniformMatrix4fv(in WebGLUniformLocation location, in boolean transpose, in Float32Array array) raises(DOMException); + + [StrictTypeChecking] void useProgram(in WebGLProgram program) raises(DOMException); + [StrictTypeChecking] void validateProgram(in WebGLProgram program) raises(DOMException); + + [StrictTypeChecking] void vertexAttrib1f(in unsigned long indx, in float x); + [StrictTypeChecking, Custom] void vertexAttrib1fv(in unsigned long indx, in Float32Array values); + [StrictTypeChecking] void vertexAttrib2f(in unsigned long indx, in float x, in float y); + [StrictTypeChecking, Custom] void vertexAttrib2fv(in unsigned long indx, in Float32Array values); + [StrictTypeChecking] void vertexAttrib3f(in unsigned long indx, in float x, in float y, in float z); + [StrictTypeChecking, Custom] void vertexAttrib3fv(in unsigned long indx, in Float32Array values); + [StrictTypeChecking] void vertexAttrib4f(in unsigned long indx, in float x, in float y, in float z, in float w); + [StrictTypeChecking, Custom] void vertexAttrib4fv(in unsigned long indx, in Float32Array values); + [StrictTypeChecking] void vertexAttribPointer(in unsigned long indx, in long size, in unsigned long type, in boolean normalized, + in long stride, in long long offset) raises(DOMException); + + [StrictTypeChecking] void viewport(in long x, in long y, in long width, in long height); +}; diff --git a/Source/WebCore/html/canvas/WebGLShader.idl b/Source/WebCore/html/canvas/WebGLShader.idl index 2aeb704d6..0ebae3829 100644 --- a/Source/WebCore/html/canvas/WebGLShader.idl +++ b/Source/WebCore/html/canvas/WebGLShader.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLShader { - }; -} +[ + Conditional=WEBGL +] interface WebGLShader { +}; diff --git a/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl b/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl index 95294f942..a217fcb89 100644 --- a/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl +++ b/Source/WebCore/html/canvas/WebGLShaderPrecisionFormat.idl @@ -24,14 +24,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=WEBGL, +] interface WebGLShaderPrecisionFormat { + readonly attribute long rangeMin; + readonly attribute long rangeMax; + readonly attribute long precision; +}; - interface [ - Conditional=WEBGL, - ] WebGLShaderPrecisionFormat { - readonly attribute long rangeMin; - readonly attribute long rangeMax; - readonly attribute long precision; - }; - -} diff --git a/Source/WebCore/html/canvas/WebGLTexture.idl b/Source/WebCore/html/canvas/WebGLTexture.idl index 8e72dd34d..1ea2f2bca 100644 --- a/Source/WebCore/html/canvas/WebGLTexture.idl +++ b/Source/WebCore/html/canvas/WebGLTexture.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLTexture { - }; -} +[ + Conditional=WEBGL +] interface WebGLTexture { +}; diff --git a/Source/WebCore/html/canvas/WebGLUniformLocation.idl b/Source/WebCore/html/canvas/WebGLUniformLocation.idl index eb3167cd9..c211189de 100644 --- a/Source/WebCore/html/canvas/WebGLUniformLocation.idl +++ b/Source/WebCore/html/canvas/WebGLUniformLocation.idl @@ -24,9 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLUniformLocation { - }; -} +[ + Conditional=WEBGL +] interface WebGLUniformLocation { +}; diff --git a/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.idl b/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.idl index 0abbe0746..1e78ddd37 100644 --- a/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.idl +++ b/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=WEBGL - ] WebGLVertexArrayObjectOES { - }; -} +[ + Conditional=WEBGL +] interface WebGLVertexArrayObjectOES { +}; diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index 0d66be471..2ea904dea 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -368,7 +368,7 @@ void HTMLConstructionSite::insertTextNode(const String& characters, WhitespaceMo // FIXME: We're only supposed to append to this text node if it // was the last text node inserted by the parser. CharacterData* textNode = static_cast<CharacterData*>(previousChild); - currentPosition = textNode->parserAppendData(characters.characters(), characters.length(), Text::defaultLengthLimit); + currentPosition = textNode->parserAppendData(characters, 0, Text::defaultLengthLimit); } while (currentPosition < characters.length()) { diff --git a/Source/WebCore/html/parser/HTMLTokenizer.cpp b/Source/WebCore/html/parser/HTMLTokenizer.cpp index b25885f64..90bc39fad 100644 --- a/Source/WebCore/html/parser/HTMLTokenizer.cpp +++ b/Source/WebCore/html/parser/HTMLTokenizer.cpp @@ -74,14 +74,15 @@ static inline UChar toLowerCase(UChar cc) return cc + lowerCaseOffset; } -static inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& string) +static inline bool vectorEqualsString(const Vector<LChar, 32>& vector, const String& string) { if (vector.size() != string.length()) return false; - const UChar* stringData = string.characters(); - const UChar* vectorData = vector.data(); - // FIXME: Is there a higher-level function we should be calling here? - return !memcmp(stringData, vectorData, vector.size() * sizeof(UChar)); + + if (!string.length()) + return true; + + return equal(string.impl(), vector.data(), vector.size()); } static inline bool isEndTagBufferingState(HTMLTokenizerState::State state) @@ -371,11 +372,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RCDATAEndTagOpenState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else { @@ -388,27 +389,27 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RCDATAEndTagNameState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(RCDATAEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); } } else if (cc == '/') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); } } else if (cc == '>') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); return flushEmitAndResumeIn(source, HTMLTokenizerState::DataState); } } @@ -436,11 +437,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RAWTEXTEndTagOpenState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else { @@ -453,28 +454,27 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(RAWTEXTEndTagNameState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(RAWTEXTEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); } } else if (cc == '/') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); } } else if (cc == '>') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); - m_token->setConvertTo8BitIfPossible(); + m_temporaryBuffer.append(static_cast<LChar>(cc)); return flushEmitAndResumeIn(source, HTMLTokenizerState::DataState); } } @@ -506,11 +506,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEndTagOpenState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else { @@ -523,28 +523,27 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEndTagNameState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(ScriptDataEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); } } else if (cc == '/') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); } } else if (cc == '>') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); - m_token->setConvertTo8BitIfPossible(); + m_temporaryBuffer.append(static_cast<LChar>(cc)); return flushEmitAndResumeIn(source, HTMLTokenizerState::DataState); } } @@ -642,7 +641,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) bufferCharacter('<'); bufferCharacter(cc); m_temporaryBuffer.clear(); - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataDoubleEscapeStartState); } else { bufferCharacter('<'); @@ -653,11 +652,11 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEscapedEndTagOpenState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else { @@ -670,27 +669,27 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_BEGIN_STATE(ScriptDataEscapedEndTagNameState) { if (isASCIIUpper(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(toLowerCase(cc)); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else if (isASCIILower(cc)) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); addToPossibleEndTag(cc); HTML_ADVANCE_TO(ScriptDataEscapedEndTagNameState); } else { if (isTokenizerWhitespace(cc)) { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState); } } else if (cc == '/') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState); } } else if (cc == '>') { if (isAppropriateEndTag()) { - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); return flushEmitAndResumeIn(source, HTMLTokenizerState::DataState); } } @@ -717,7 +716,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_ADVANCE_TO(ScriptDataDoubleEscapeStartState); } else if (isASCIILower(cc)) { bufferCharacter(cc); - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataDoubleEscapeStartState); } else HTML_RECONSUME_IN(ScriptDataEscapedState); @@ -801,7 +800,7 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token) HTML_ADVANCE_TO(ScriptDataDoubleEscapeEndState); } else if (isASCIILower(cc)) { bufferCharacter(cc); - m_temporaryBuffer.append(cc); + m_temporaryBuffer.append(static_cast<LChar>(cc)); HTML_ADVANCE_TO(ScriptDataDoubleEscapeEndState); } else HTML_RECONSUME_IN(ScriptDataDoubleEscapedState); diff --git a/Source/WebCore/html/parser/HTMLTokenizer.h b/Source/WebCore/html/parser/HTMLTokenizer.h index ff2d9ac95..4c665f7a3 100644 --- a/Source/WebCore/html/parser/HTMLTokenizer.h +++ b/Source/WebCore/html/parser/HTMLTokenizer.h @@ -209,7 +209,7 @@ private: bool m_shouldAllowCDATA; // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer - Vector<UChar, 32> m_temporaryBuffer; + Vector<LChar, 32> m_temporaryBuffer; // We occationally want to emit both a character token and an end tag // token (e.g., when lexing script). We buffer the name of the end tag diff --git a/Source/WebCore/html/shadow/ContentDistributor.cpp b/Source/WebCore/html/shadow/ContentDistributor.cpp index 076a723c8..40059c609 100644 --- a/Source/WebCore/html/shadow/ContentDistributor.cpp +++ b/Source/WebCore/html/shadow/ContentDistributor.cpp @@ -57,8 +57,21 @@ void ContentDistributor::distribute(Element* host) m_validity = Valid; ContentDistribution pool; - for (Node* node = host->firstChild(); node; node = node->nextSibling()) - pool.append(node); + for (Node* node = host->firstChild(); node; node = node->nextSibling()) { + if (!isInsertionPoint(node)) { + pool.append(node); + continue; + } + + InsertionPoint* insertionPoint = toInsertionPoint(node); + if (insertionPoint->hasDistribution()) { + for (size_t i = 0; i < insertionPoint->size(); ++i) + pool.append(insertionPoint->at(i)); + } else { + for (Node* fallbackNode = insertionPoint->firstChild(); fallbackNode; fallbackNode = fallbackNode->nextSibling()) + pool.append(fallbackNode); + } + } Vector<bool> distributed(pool.size()); distributed.fill(false); @@ -117,10 +130,10 @@ void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint, if (distributed[i]) continue; - Node* child = pool[i].get(); - if (!query.matches(child)) + if (!query.matches(pool, i)) continue; + Node* child = pool[i].get(); distribution.append(child); m_nodeToInsertionPoint.add(child, insertionPoint); distributed[i] = true; diff --git a/Source/WebCore/html/shadow/ContentSelectorQuery.cpp b/Source/WebCore/html/shadow/ContentSelectorQuery.cpp index f12c59925..0a6ec32ee 100644 --- a/Source/WebCore/html/shadow/ContentSelectorQuery.cpp +++ b/Source/WebCore/html/shadow/ContentSelectorQuery.cpp @@ -30,16 +30,45 @@ #include "CSSParser.h" #include "CSSSelectorList.h" #include "InsertionPoint.h" +#include "SelectorChecker.h" #include "ShadowRoot.h" +#include "SiblingTraversalStrategies.h" namespace WebCore { +ContentSelectorChecker::ContentSelectorChecker(Document* document, bool strictParsing) + : m_selectorChecker(document, strictParsing) +{ + m_selectorChecker.setMode(SelectorChecker::CollectingRules); +} + +bool ContentSelectorChecker::checkContentSelector(CSSSelector* selector, const Vector<RefPtr<Node> >& siblings, int nth) const +{ + SelectorChecker::SelectorCheckingContext context(selector, toElement(siblings[nth].get()), SelectorChecker::VisitedMatchEnabled); + ShadowDOMSiblingTraversalStrategy strategy(siblings, nth); + return m_selectorChecker.checkOneSelector(context, strategy); +} + +void ContentSelectorDataList::initialize(const CSSSelectorList& selectors) +{ + for (CSSSelector* selector = selectors.first(); selector; selector = CSSSelectorList::next(selector)) + m_selectors.append(selector); +} + +bool ContentSelectorDataList::matches(const ContentSelectorChecker& selectorChecker, const Vector<RefPtr<Node> >& siblings, int nth) const +{ + unsigned selectorCount = m_selectors.size(); + for (unsigned i = 0; i < selectorCount; ++i) { + if (selectorChecker.checkContentSelector(m_selectors[i], siblings, nth)) + return true; + } + return false; +} + ContentSelectorQuery::ContentSelectorQuery(const InsertionPoint* insertionPoint) : m_insertionPoint(insertionPoint) , m_selectorChecker(insertionPoint->document(), !insertionPoint->document()->inQuirksMode()) { - m_selectorChecker.setMode(SelectorChecker::CollectingRules); - if (insertionPoint->select().isNull() || insertionPoint->select().isEmpty()) { m_isValidSelector = true; return; @@ -58,13 +87,10 @@ bool ContentSelectorQuery::isValidSelector() const return m_isValidSelector; } -bool ContentSelectorQuery::matches(Node* node) const +bool ContentSelectorQuery::matches(const Vector<RefPtr<Node> >& siblings, int nth) const { + Node* node = siblings[nth].get(); ASSERT(node); - if (!node) - return false; - - ASSERT(node->parentNode() == m_insertionPoint->shadowRoot()->host()); if (m_insertionPoint->select().isNull() || m_insertionPoint->select().isEmpty()) return true; @@ -75,7 +101,7 @@ bool ContentSelectorQuery::matches(Node* node) const if (!node->isElementNode()) return false; - return m_selectors.matches(m_selectorChecker, toElement(node)); + return m_selectors.matches(m_selectorChecker, siblings, nth); } static bool validateSubSelector(CSSSelector* selector) diff --git a/Source/WebCore/html/shadow/ContentSelectorQuery.h b/Source/WebCore/html/shadow/ContentSelectorQuery.h index 94fa3efcc..2c710a585 100644 --- a/Source/WebCore/html/shadow/ContentSelectorQuery.h +++ b/Source/WebCore/html/shadow/ContentSelectorQuery.h @@ -43,25 +43,41 @@ class Document; class Node; class InsertionPoint; +class ContentSelectorChecker { +public: + ContentSelectorChecker(Document*, bool strictParsing); + + bool checkContentSelector(CSSSelector*, const Vector<RefPtr<Node> >& siblings, int nthNode) const; +private: + SelectorChecker m_selectorChecker; +}; + +class ContentSelectorDataList { +public: + void initialize(const CSSSelectorList&); + bool matches(const ContentSelectorChecker&, const Vector<RefPtr<Node> >& siblings, int nthNode) const; + +private: + Vector<CSSSelector*> m_selectors; +}; + class ContentSelectorQuery { WTF_MAKE_NONCOPYABLE(ContentSelectorQuery); public: explicit ContentSelectorQuery(const InsertionPoint*); bool isValidSelector() const; - bool matches(Node*) const; + bool matches(const Vector<RefPtr<Node> >& siblings, int nthNode) const; private: bool validateSelectorList(); const InsertionPoint* m_insertionPoint; - SelectorDataList m_selectors; + ContentSelectorDataList m_selectors; CSSSelectorList m_selectorList; - SelectorChecker m_selectorChecker; + ContentSelectorChecker m_selectorChecker; bool m_isValidSelector; }; } - - #endif diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp index 9a0d932bb..338c8633a 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeEditElement.h" #include "DateComponents.h" @@ -49,6 +49,7 @@ class DateTimeEditBuilder : private DateTimeFormat::TokenHandler { WTF_MAKE_NONCOPYABLE(DateTimeEditBuilder); public: + // The argument objects must be alive until this object dies. DateTimeEditBuilder(DateTimeEditElement&, const DateTimeEditElement::LayoutParameters&, const DateComponents&); bool build(const String&); @@ -58,22 +59,21 @@ private: bool shouldMillisecondFieldReadOnly() const; bool shouldMinuteFieldReadOnly() const; bool shouldSecondFieldReadOnly() const; + inline const StepRange& stepRange() const { return m_parameters.stepRange; } // DateTimeFormat::TokenHandler functions. virtual void visitField(DateTimeFormat::FieldType, int) OVERRIDE FINAL; virtual void visitLiteral(const String&) OVERRIDE FINAL; DateTimeEditElement& m_editElement; - const DateComponents& m_dateValue; - const StepRange& m_stepRange; - Localizer& m_localizer; + const DateComponents m_dateValue; + const DateTimeEditElement::LayoutParameters& m_parameters; }; DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement& elemnt, const DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& dateValue) : m_editElement(elemnt) , m_dateValue(dateValue) - , m_stepRange(layoutParameters.stepRange) - , m_localizer(layoutParameters.localizer) + , m_parameters(layoutParameters) { } @@ -86,8 +86,8 @@ bool DateTimeEditBuilder::build(const String& formatString) bool DateTimeEditBuilder::needMillisecondField() const { return m_dateValue.millisecond() - || !m_stepRange.minimum().remainder(static_cast<int>(msPerSecond)).isZero() - || !m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); + || !stepRange().minimum().remainder(static_cast<int>(msPerSecond)).isZero() + || !stepRange().step().remainder(static_cast<int>(msPerSecond)).isZero(); } void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) @@ -95,6 +95,10 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) Document* const document = m_editElement.document(); switch (fieldType) { + case DateTimeFormat::FieldTypeDayOfMonth: + m_editElement.addField(DateTimeDayFieldElement::create(document, m_editElement, m_parameters.placeholderForDay)); + return; + case DateTimeFormat::FieldTypeHour11: m_editElement.addField(DateTimeHourFieldElement::create(document, m_editElement, 0, 11)); return; @@ -119,8 +123,13 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) return; } + case DateTimeFormat::FieldTypeMonth: + // We always use "MM", two digits month, even if "M", "MMM", "MMMM", or "MMMMM". + m_editElement.addField(DateTimeMonthFieldElement::create(document, m_editElement, m_parameters.placeholderForMonth)); + return; + case DateTimeFormat::FieldTypePeriod: - m_editElement.addField(DateTimeAMPMFieldElement::create(document, m_editElement, m_localizer.timeAMPMLabels())); + m_editElement.addField(DateTimeAMPMFieldElement::create(document, m_editElement, m_parameters.localizer.timeAMPMLabels())); return; case DateTimeFormat::FieldTypeSecond: { @@ -130,7 +139,7 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) field->setReadOnly(); if (needMillisecondField()) { - visitLiteral(m_localizer.localizedDecimalSeparator()); + visitLiteral(m_parameters.localizer.localizedDecimalSeparator()); visitField(DateTimeFormat::FieldTypeFractionalSecond, 3); } return; @@ -144,6 +153,35 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) return; } + case DateTimeFormat::FieldTypeWeekOfYear: + m_editElement.addField(DateTimeWeekFieldElement::create(document, m_editElement)); + return; + + case DateTimeFormat::FieldTypeYear: { + DateTimeYearFieldElement::Parameters yearParams; + if (m_parameters.minimumYear == m_parameters.undefinedYear()) { + yearParams.minimumYear = DateComponents::minimumYear(); + yearParams.minIsSpecified = false; + } else { + yearParams.minimumYear = m_parameters.minimumYear; + yearParams.minIsSpecified = true; + } + if (m_parameters.maximumYear == m_parameters.undefinedYear()) { + yearParams.maximumYear = DateComponents::maximumYear(); + yearParams.maxIsSpecified = false; + } else { + yearParams.maximumYear = m_parameters.maximumYear; + yearParams.maxIsSpecified = true; + } + if (yearParams.minimumYear > yearParams.maximumYear) { + std::swap(yearParams.minimumYear, yearParams.maximumYear); + std::swap(yearParams.minIsSpecified, yearParams.maxIsSpecified); + } + yearParams.placeholder = m_parameters.placeholderForYear; + m_editElement.addField(DateTimeYearFieldElement::create(document, m_editElement, yearParams)); + return; + } + default: return; } @@ -151,32 +189,27 @@ void DateTimeEditBuilder::visitField(DateTimeFormat::FieldType fieldType, int) bool DateTimeEditBuilder::shouldMillisecondFieldReadOnly() const { - return !m_dateValue.millisecond() && m_stepRange.step().remainder(static_cast<int>(msPerSecond)).isZero(); + return !m_dateValue.millisecond() && stepRange().step().remainder(static_cast<int>(msPerSecond)).isZero(); } bool DateTimeEditBuilder::shouldMinuteFieldReadOnly() const { - return !m_dateValue.minute() && m_stepRange.step().remainder(static_cast<int>(msPerHour)).isZero(); + return !m_dateValue.minute() && stepRange().step().remainder(static_cast<int>(msPerHour)).isZero(); } bool DateTimeEditBuilder::shouldSecondFieldReadOnly() const { - return !m_dateValue.second() && m_stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); + return !m_dateValue.second() && stepRange().step().remainder(static_cast<int>(msPerMinute)).isZero(); } void DateTimeEditBuilder::visitLiteral(const String& text) { + DEFINE_STATIC_LOCAL(AtomicString, textPseudoId, ("-webkit-datetime-edit-text", AtomicString::ConstructFromLiteral)); ASSERT(text.length()); - m_editElement.appendChild(Text::create(m_editElement.document(), text)); -} - -// ---------------------------- - - -bool DateTimeEditElement::LayoutParameters::shouldHaveSecondField() const -{ - return !stepRange.minimum().remainder(static_cast<int>(msPerMinute)).isZero() - || !stepRange.step().remainder(static_cast<int>(msPerMinute)).isZero(); + RefPtr<HTMLDivElement> element = HTMLDivElement::create(m_editElement.document()); + element->setShadowPseudoId(textPseudoId); + element->appendChild(Text::create(m_editElement.document(), text)); + m_editElement.appendChild(element); } // ---------------------------- @@ -325,6 +358,11 @@ bool DateTimeEditElement::isDisabled() const return m_editControlOwner && m_editControlOwner->isEditControlOwnerDisabled(); } +bool DateTimeEditElement::isFieldOwnerDisabledOrReadOnly() const +{ + return isDisabled() || isReadOnly(); +} + bool DateTimeEditElement::isReadOnly() const { return m_editControlOwner && m_editControlOwner->isEditControlOwnerReadOnly(); @@ -362,11 +400,20 @@ void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const } } + DEFINE_STATIC_LOCAL(AtomicString, gapPseudoId, ("-webkit-datetime-edit-gap", AtomicString::ConstructFromLiteral)); + RefPtr<HTMLDivElement> gapElement = HTMLDivElement::create(document()); + gapElement->setShadowPseudoId(gapPseudoId); + appendChild(gapElement); RefPtr<SpinButtonElement> spinButton = SpinButtonElement::create(document(), *this); m_spinButton = spinButton.get(); appendChild(spinButton); } +AtomicString DateTimeEditElement::localeIdentifier() const +{ + return m_editControlOwner ? m_editControlOwner->localeIdentifier() : nullAtom; +} + void DateTimeEditElement::readOnlyStateChanged() { updateUIState(); diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.h b/Source/WebCore/html/shadow/DateTimeEditElement.h index 84cf229c6..f039e9954 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.h +++ b/Source/WebCore/html/shadow/DateTimeEditElement.h @@ -26,7 +26,7 @@ #ifndef DateTimeEditElement_h #define DateTimeEditElement_h -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldElement.h" #include "SpinButtonElement.h" #include "StepRange.h" @@ -58,21 +58,29 @@ public: virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const = 0; virtual bool isEditControlOwnerDisabled() const = 0; virtual bool isEditControlOwnerReadOnly() const = 0; + virtual AtomicString localeIdentifier() const = 0; }; struct LayoutParameters { String dateTimeFormat; String fallbackDateTimeFormat; Localizer& localizer; - const StepRange& stepRange; + const StepRange stepRange; + int minimumYear; + int maximumYear; + String placeholderForDay; + String placeholderForMonth; + String placeholderForYear; LayoutParameters(Localizer& localizer, const StepRange& stepRange) : localizer(localizer) , stepRange(stepRange) + , minimumYear(undefinedYear()) + , maximumYear(undefinedYear()) { } - bool shouldHaveSecondField() const; + static inline int undefinedYear() { return -1; } }; static PassRefPtr<DateTimeEditElement> create(Document*, EditControlOwner&); @@ -123,6 +131,8 @@ private: virtual void fieldValueChanged() OVERRIDE FINAL; virtual bool focusOnNextField(const DateTimeFieldElement&) OVERRIDE FINAL; virtual bool focusOnPreviousField(const DateTimeFieldElement&) OVERRIDE FINAL; + virtual bool isFieldOwnerDisabledOrReadOnly() const OVERRIDE FINAL; + virtual AtomicString localeIdentifier() const OVERRIDE FINAL; // SpinButtonElement::SpinButtonOwner functions. virtual void focusAndSelectSpinButtonOwner() OVERRIDE FINAL; diff --git a/Source/WebCore/html/shadow/DateTimeFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeFieldElement.cpp index a0ec51e59..6512ac1cb 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeFieldElement.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldElement.h" #include "DateComponents.h" @@ -80,6 +80,8 @@ void DateTimeFieldElement::defaultKeyboardEventHandler(KeyboardEvent* keyboardEv const String& keyIdentifier = keyboardEvent->keyIdentifier(); if (keyIdentifier == "Down") { + if (keyboardEvent->getModifierState("Alt")) + return; keyboardEvent->setDefaultHandled(); stepDown(); return; @@ -144,7 +146,11 @@ void DateTimeFieldElement::initialize(const AtomicString& shadowPseudoId, const bool DateTimeFieldElement::isFocusable() const { - return !isReadOnly(); + if (isReadOnly()) + return false; + if (m_fieldOwner && m_fieldOwner->isFieldOwnerDisabledOrReadOnly()) + return false; + return HTMLElement::isFocusable(); } bool DateTimeFieldElement::isReadOnly() const @@ -157,6 +163,11 @@ bool DateTimeFieldElement::isRTL() const return renderer() && renderer()->style()->direction() == RTL; } +AtomicString DateTimeFieldElement::localeIdentifier() const +{ + return m_fieldOwner ? m_fieldOwner->localeIdentifier() : nullAtom; +} + void DateTimeFieldElement::setReadOnly() { // Set HTML attribute readonly to change apperance. diff --git a/Source/WebCore/html/shadow/DateTimeFieldElement.h b/Source/WebCore/html/shadow/DateTimeFieldElement.h index f5c9810a1..c926cbe11 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElement.h +++ b/Source/WebCore/html/shadow/DateTimeFieldElement.h @@ -26,7 +26,7 @@ #ifndef DateTimeFieldElement_h #define DateTimeFieldElement_h -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "HTMLDivElement.h" @@ -55,6 +55,8 @@ public: virtual void fieldValueChanged() = 0; virtual bool focusOnNextField(const DateTimeFieldElement&) = 0; virtual bool focusOnPreviousField(const DateTimeFieldElement&) = 0; + virtual bool isFieldOwnerDisabledOrReadOnly() const = 0; + virtual AtomicString localeIdentifier() const = 0; }; virtual void defaultEventHandler(Event*) OVERRIDE; @@ -80,6 +82,7 @@ protected: void focusOnNextField(); virtual void handleKeyboardEvent(KeyboardEvent*) = 0; void initialize(const AtomicString& shadowPseudoId, const String& axHelpText); + AtomicString localeIdentifier() const; virtual int maximum() const = 0; virtual int minimum() const = 0; void updateVisibleValue(EventBehavior); diff --git a/Source/WebCore/html/shadow/DateTimeFieldElements.cpp b/Source/WebCore/html/shadow/DateTimeFieldElements.cpp index c2f458a21..adcc7227a 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElements.cpp +++ b/Source/WebCore/html/shadow/DateTimeFieldElements.cpp @@ -24,12 +24,14 @@ */ #include "config.h" -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldElements.h" #include "DateComponents.h" #include "DateTimeFieldsState.h" #include "LocalizedStrings.h" +#include <wtf/CurrentTime.h> +#include <wtf/DateMath.h> namespace WebCore { @@ -69,8 +71,49 @@ void DateTimeAMPMFieldElement::setValueAsDateTimeFieldsState(const DateTimeField // ---------------------------- +DateTimeDayFieldElement::DateTimeDayFieldElement(Document* document, FieldOwner& fieldOwner, const String& placeholder) + : DateTimeNumericFieldElement(document, fieldOwner, 1, 31, placeholder) +{ +} + +PassRefPtr<DateTimeDayFieldElement> DateTimeDayFieldElement::create(Document* document, FieldOwner& fieldOwner, const String& placeholder) +{ + DEFINE_STATIC_LOCAL(AtomicString, dayPsuedoId, ("-webkit-datetime-edit-day-field")); + RefPtr<DateTimeDayFieldElement> field = adoptRef(new DateTimeDayFieldElement(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral("--") : placeholder)); + field->initialize(dayPsuedoId, AXDayOfMonthFieldText()); + return field.release(); +} + +void DateTimeDayFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& dateTimeFieldsState) +{ + dateTimeFieldsState.setDayOfMonth(hasValue() ? valueAsInteger() : DateTimeFieldsState::emptyValue); +} + +void DateTimeDayFieldElement::setValueAsDate(const DateComponents& date) +{ + setValueAsInteger(date.monthDay()); +} + +void DateTimeDayFieldElement::setValueAsDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState, const DateComponents& dateForReadOnlyField) +{ + if (!dateTimeFieldsState.hasDayOfMonth()) { + setEmptyValue(dateForReadOnlyField); + return; + } + + const unsigned value = dateTimeFieldsState.dayOfMonth(); + if (range().isInRange(static_cast<int>(value))) { + setValueAsInteger(value); + return; + } + + setEmptyValue(dateForReadOnlyField); +} + +// ---------------------------- + DateTimeHourFieldElement::DateTimeHourFieldElement(Document* document, FieldOwner& fieldOwner, int minimum, int maximum) - : DateTimeNumericFieldElement(document, fieldOwner, minimum, maximum) + : DateTimeNumericFieldElement(document, fieldOwner, minimum, maximum, "--") , m_alignment(maximum + maximum % 2) { ASSERT((!minimum && (maximum == 11 || maximum == 23)) || (minimum == 1 && (maximum == 12 || maximum == 24))); @@ -175,7 +218,7 @@ int DateTimeHourFieldElement::valueAsInteger() const // ---------------------------- DateTimeMillisecondFieldElement::DateTimeMillisecondFieldElement(Document* document, FieldOwner& fieldOwner) - : DateTimeNumericFieldElement(document, fieldOwner, 0, 999) + : DateTimeNumericFieldElement(document, fieldOwner, 0, 999, "---") { } @@ -216,7 +259,7 @@ void DateTimeMillisecondFieldElement::setValueAsDateTimeFieldsState(const DateTi // ---------------------------- DateTimeMinuteFieldElement::DateTimeMinuteFieldElement(Document* document, FieldOwner& fieldOwner) - : DateTimeNumericFieldElement(document, fieldOwner, 0, 59) + : DateTimeNumericFieldElement(document, fieldOwner, 0, 59, "--") { } @@ -256,8 +299,49 @@ void DateTimeMinuteFieldElement::setValueAsDateTimeFieldsState(const DateTimeFie // ---------------------------- +DateTimeMonthFieldElement::DateTimeMonthFieldElement(Document* document, FieldOwner& fieldOwner, const String& placeholder) + : DateTimeNumericFieldElement(document, fieldOwner, 1, 12, placeholder) +{ +} + +PassRefPtr<DateTimeMonthFieldElement> DateTimeMonthFieldElement::create(Document* document, FieldOwner& fieldOwner, const String& placeholder) +{ + DEFINE_STATIC_LOCAL(AtomicString, monthPsuedoId, ("-webkit-datetime-edit-month-field")); + RefPtr<DateTimeMonthFieldElement> field = adoptRef(new DateTimeMonthFieldElement(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral("--") : placeholder)); + field->initialize(monthPsuedoId, AXMonthFieldText()); + return field.release(); +} + +void DateTimeMonthFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& dateTimeFieldsState) +{ + dateTimeFieldsState.setMonth(hasValue() ? valueAsInteger() : DateTimeFieldsState::emptyValue); +} + +void DateTimeMonthFieldElement::setValueAsDate(const DateComponents& date) +{ + setValueAsInteger(date.month() + 1); +} + +void DateTimeMonthFieldElement::setValueAsDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState, const DateComponents& dateForReadOnlyField) +{ + if (!dateTimeFieldsState.hasMonth()) { + setEmptyValue(dateForReadOnlyField); + return; + } + + const unsigned value = dateTimeFieldsState.month(); + if (range().isInRange(static_cast<int>(value))) { + setValueAsInteger(value); + return; + } + + setEmptyValue(dateForReadOnlyField); +} + +// ---------------------------- + DateTimeSecondFieldElement::DateTimeSecondFieldElement(Document* document, FieldOwner& fieldOwner) - : DateTimeNumericFieldElement(document, fieldOwner, 0, 59) + : DateTimeNumericFieldElement(document, fieldOwner, 0, 59, "--") { } @@ -295,6 +379,120 @@ void DateTimeSecondFieldElement::setValueAsDateTimeFieldsState(const DateTimeFie setValueAsInteger(value); } +// ---------------------------- + +DateTimeWeekFieldElement::DateTimeWeekFieldElement(Document* document, FieldOwner& fieldOwner) + : DateTimeNumericFieldElement(document, fieldOwner, DateComponents::minimumWeekNumber, DateComponents::maximumWeekNumber, "--") +{ +} + +PassRefPtr<DateTimeWeekFieldElement> DateTimeWeekFieldElement::create(Document* document, FieldOwner& fieldOwner) +{ + DEFINE_STATIC_LOCAL(AtomicString, weekPsuedoId, ("-webkit-datetime-edit-week-field")); + RefPtr<DateTimeWeekFieldElement> field = adoptRef(new DateTimeWeekFieldElement(document, fieldOwner)); + field->initialize(weekPsuedoId, AXWeekOfYearFieldText()); + return field.release(); +} + +void DateTimeWeekFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& dateTimeFieldsState) +{ + dateTimeFieldsState.setWeekOfYear(hasValue() ? valueAsInteger() : DateTimeFieldsState::emptyValue); +} + +void DateTimeWeekFieldElement::setValueAsDate(const DateComponents& date) +{ + setValueAsInteger(date.week()); +} + +void DateTimeWeekFieldElement::setValueAsDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState, const DateComponents& dateForReadOnlyField) +{ + if (!dateTimeFieldsState.hasWeekOfYear()) { + setEmptyValue(dateForReadOnlyField); + return; + } + + const unsigned value = dateTimeFieldsState.weekOfYear(); + if (range().isInRange(static_cast<int>(value))) { + setValueAsInteger(value); + return; + } + + setEmptyValue(dateForReadOnlyField); +} + +// ---------------------------- + +DateTimeYearFieldElement::DateTimeYearFieldElement(Document* document, FieldOwner& fieldOwner, const DateTimeYearFieldElement::Parameters& parameters) + : DateTimeNumericFieldElement(document, fieldOwner, parameters.minimumYear, parameters.maximumYear, parameters.placeholder.isEmpty() ? ASCIILiteral("----") : parameters.placeholder) + , m_minIsSpecified(parameters.minIsSpecified) + , m_maxIsSpecified(parameters.maxIsSpecified) +{ + ASSERT(parameters.minimumYear >= DateComponents::minimumYear()); + ASSERT(parameters.maximumYear <= DateComponents::maximumYear()); +} + +PassRefPtr<DateTimeYearFieldElement> DateTimeYearFieldElement::create(Document* document, FieldOwner& fieldOwner, const DateTimeYearFieldElement::Parameters& parameters) +{ + DEFINE_STATIC_LOCAL(AtomicString, yearPsuedoId, ("-webkit-datetime-edit-year-field")); + RefPtr<DateTimeYearFieldElement> field = adoptRef(new DateTimeYearFieldElement(document, fieldOwner, parameters)); + field->initialize(yearPsuedoId, AXYearFieldText()); + return field.release(); +} + +int DateTimeYearFieldElement::clampValueForHardLimits(int value) const +{ + return Range(DateComponents::minimumYear(), DateComponents::maximumYear()).clampValue(value); +} + +static int currentFullYear() +{ + double current = currentTimeMS(); + double utcOffset = calculateUTCOffset(); + double dstOffset = calculateDSTOffset(current, utcOffset); + int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute); + current += offset * msPerMinute; + + DateComponents date; + date.setMillisecondsSinceEpochForMonth(current); + return date.fullYear(); +} + +int DateTimeYearFieldElement::defaultValueForStepDown() const +{ + return m_maxIsSpecified ? DateTimeNumericFieldElement::defaultValueForStepDown() : currentFullYear(); +} + +int DateTimeYearFieldElement::defaultValueForStepUp() const +{ + return m_minIsSpecified ? DateTimeNumericFieldElement::defaultValueForStepUp() : currentFullYear(); +} + +void DateTimeYearFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& dateTimeFieldsState) +{ + dateTimeFieldsState.setYear(hasValue() ? valueAsInteger() : DateTimeFieldsState::emptyValue); +} + +void DateTimeYearFieldElement::setValueAsDate(const DateComponents& date) +{ + setValueAsInteger(date.fullYear()); +} + +void DateTimeYearFieldElement::setValueAsDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState, const DateComponents& dateForReadOnlyField) +{ + if (!dateTimeFieldsState.hasYear()) { + setEmptyValue(dateForReadOnlyField); + return; + } + + const unsigned value = dateTimeFieldsState.year(); + if (range().isInRange(static_cast<int>(value))) { + setValueAsInteger(value); + return; + } + + setEmptyValue(dateForReadOnlyField); +} + } // namespace WebCore #endif diff --git a/Source/WebCore/html/shadow/DateTimeFieldElements.h b/Source/WebCore/html/shadow/DateTimeFieldElements.h index 23f3403ea..46d51a786 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElements.h +++ b/Source/WebCore/html/shadow/DateTimeFieldElements.h @@ -26,7 +26,7 @@ #ifndef DateTimeFieldElements_h #define DateTimeFieldElements_h -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeNumericFieldElement.h" #include "DateTimeSymbolicFieldElement.h" @@ -47,6 +47,20 @@ private: virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; }; +class DateTimeDayFieldElement : public DateTimeNumericFieldElement { + WTF_MAKE_NONCOPYABLE(DateTimeDayFieldElement); + +public: + static PassRefPtr<DateTimeDayFieldElement> create(Document*, FieldOwner&, const String& placeholder); + +private: + DateTimeDayFieldElement(Document*, FieldOwner&, const String& placeholder); + + // DateTimeFieldElement functions. + virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; + virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; + virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; +}; // DateTimeHourFieldElement is used for hour field of date time format // supporting following patterns: @@ -103,6 +117,21 @@ private: virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; }; +class DateTimeMonthFieldElement : public DateTimeNumericFieldElement { + WTF_MAKE_NONCOPYABLE(DateTimeMonthFieldElement); + +public: + static PassRefPtr<DateTimeMonthFieldElement> create(Document*, FieldOwner&, const String& placeholder); + +private: + DateTimeMonthFieldElement(Document*, FieldOwner&, const String& placeholder); + + // DateTimeFieldElement functions. + virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; + virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; + virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; +}; + class DateTimeSecondFieldElement : public DateTimeNumericFieldElement { WTF_MAKE_NONCOPYABLE(DateTimeSecondFieldElement); @@ -118,6 +147,60 @@ private: virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; }; +class DateTimeWeekFieldElement : public DateTimeNumericFieldElement { + WTF_MAKE_NONCOPYABLE(DateTimeWeekFieldElement); + +public: + static PassRefPtr<DateTimeWeekFieldElement> create(Document*, FieldOwner&); + +private: + DateTimeWeekFieldElement(Document*, FieldOwner&); + + // DateTimeFieldElement functions. + virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; + virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; + virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; +}; + +class DateTimeYearFieldElement : public DateTimeNumericFieldElement { + WTF_MAKE_NONCOPYABLE(DateTimeYearFieldElement); + +public: + struct Parameters { + int minimumYear; + int maximumYear; + bool minIsSpecified; + bool maxIsSpecified; + String placeholder; + + Parameters() + : minimumYear(-1) + , maximumYear(-1) + , minIsSpecified(false) + , maxIsSpecified(false) + { + } + }; + + static PassRefPtr<DateTimeYearFieldElement> create(Document*, FieldOwner&, const Parameters&); + +private: + DateTimeYearFieldElement(Document*, FieldOwner&, const Parameters&); + + // DateTimeFieldElement functions. + virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; + virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; + virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; + + // DateTimeNumericFieldElement functions. + virtual int clampValueForHardLimits(int) const OVERRIDE FINAL; + virtual int defaultValueForStepDown() const OVERRIDE FINAL; + virtual int defaultValueForStepUp() const OVERRIDE FINAL; + + bool m_minIsSpecified; + bool m_maxIsSpecified; +}; + } // namespace WebCore #endif diff --git a/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp index cf8a4a338..ffb03979d 100644 --- a/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp @@ -24,33 +24,21 @@ */ #include "config.h" -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeNumericFieldElement.h" +#include "FontCache.h" #include "KeyboardEvent.h" -#include "LocalizedNumber.h" +#include "Localizer.h" +#include "RenderStyle.h" +#include "StyleResolver.h" +#include "TextRun.h" #include <wtf/text/StringBuilder.h> namespace WebCore { static const DOMTimeStamp typeAheadTimeout = 1000; -static size_t displaySizeOfNumber(int value) -{ - ASSERT(value >= 0); - - if (!value) - return 1; - - int numberOfDigits = 0; - while (value) { - value /= 10; - ++numberOfDigits; - } - - return numberOfDigits; -} - DateTimeNumericFieldElement::Range::Range(int minimum, int maximum) : maximum(maximum) , minimum(minimum) @@ -63,13 +51,49 @@ int DateTimeNumericFieldElement::Range::clampValue(int value) const return std::min(std::max(value, minimum), maximum); } -DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document* document, FieldOwner& fieldOwner, int minimum, int maximum) +bool DateTimeNumericFieldElement::Range::isInRange(int value) const +{ + return value >= minimum && value <= maximum; +} + +// ---------------------------- + +DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document* document, FieldOwner& fieldOwner, int minimum, int maximum, const String& placeholder) : DateTimeFieldElement(document, fieldOwner) , m_lastDigitCharTime(0) + , m_placeholder(placeholder) , m_range(minimum, maximum) , m_value(0) , m_hasValue(false) { + setHasCustomCallbacks(); +} + +int DateTimeNumericFieldElement::clampValueForHardLimits(int value) const +{ + return clampValue(value); +} + +PassRefPtr<RenderStyle> DateTimeNumericFieldElement::customStyleForRenderer() +{ + FontCachePurgePreventer fontCachePurgePreventer; + RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); + RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); + float maxiumWidth = style->font().width(m_placeholder); + maxiumWidth = std::max(maxiumWidth, style->font().width(formatValue(maximum()))); + maxiumWidth = std::max(maxiumWidth, style->font().width(value())); + style->setWidth(Length(maxiumWidth, Fixed)); + return style.release(); +} + +int DateTimeNumericFieldElement::defaultValueForStepDown() const +{ + return m_range.maximum; +} + +int DateTimeNumericFieldElement::defaultValueForStepUp() const +{ + return m_range.minimum; } void DateTimeNumericFieldElement::didBlur() @@ -78,6 +102,16 @@ void DateTimeNumericFieldElement::didBlur() DateTimeFieldElement::didBlur(); } +String DateTimeNumericFieldElement::formatValue(int value) const +{ + Localizer& localizer = localizerForOwner(); + if (m_range.maximum > 999) + return localizer.convertToLocalizedNumber(String::format("%04d", value)); + if (m_range.maximum > 99) + return localizer.convertToLocalizedNumber(String::format("%03d", value)); + return localizer.convertToLocalizedNumber(String::format("%02d", value)); +} + void DateTimeNumericFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEvent) { if (isReadOnly()) @@ -93,7 +127,7 @@ void DateTimeNumericFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEve DOMTimeStamp delta = keyboardEvent->timeStamp() - m_lastDigitCharTime; m_lastDigitCharTime = 0; - String number = convertFromLocalizedNumber(String(&charCode, 1)); + String number = localizerForOwner().convertFromLocalizedNumber(String(&charCode, 1)); const int digit = number[0] - '0'; if (digit < 0 || digit > 9) return; @@ -111,6 +145,11 @@ bool DateTimeNumericFieldElement::hasValue() const return m_hasValue; } +Localizer& DateTimeNumericFieldElement::localizerForOwner() const +{ + return document()->getCachedLocalizer(localeIdentifier()); +} + int DateTimeNumericFieldElement::maximum() const { return m_range.maximum; @@ -137,7 +176,7 @@ void DateTimeNumericFieldElement::setEmptyValue(const DateComponents& dateForRea void DateTimeNumericFieldElement::setValueAsInteger(int value, EventBehavior eventBehavior) { - m_value = clampValue(value); + m_value = clampValueForHardLimits(value); m_hasValue = true; updateVisibleValue(eventBehavior); m_lastDigitCharTime = 0; @@ -148,7 +187,7 @@ void DateTimeNumericFieldElement::stepDown() if (m_hasValue) setValueAsInteger(m_value == m_range.minimum ? m_range.maximum : clampValue(m_value - 1), DispatchEvent); else - setValueAsInteger(m_range.maximum, DispatchEvent); + setValueAsInteger(defaultValueForStepDown(), DispatchEvent); } void DateTimeNumericFieldElement::stepUp() @@ -156,21 +195,12 @@ void DateTimeNumericFieldElement::stepUp() if (m_hasValue) setValueAsInteger(m_value == m_range.maximum ? m_range.minimum : clampValue(m_value + 1), DispatchEvent); else - setValueAsInteger(m_range.minimum, DispatchEvent); + setValueAsInteger(defaultValueForStepUp(), DispatchEvent); } String DateTimeNumericFieldElement::value() const { - if (!m_hasValue) - return emptyString(); - - if (m_range.maximum > 999) - return convertToLocalizedNumber(String::number(m_value)); - - if (m_range.maximum > 99) - return convertToLocalizedNumber(String::format("%03d", m_value)); - - return convertToLocalizedNumber(String::format("%02d", m_value)); + return m_hasValue ? formatValue(m_value) : emptyString(); } int DateTimeNumericFieldElement::valueAsInteger() const @@ -180,13 +210,7 @@ int DateTimeNumericFieldElement::valueAsInteger() const String DateTimeNumericFieldElement::visibleValue() const { - if (m_hasValue) - return value(); - - StringBuilder builder; - for (int numberOfDashs = std::max(displaySizeOfNumber(m_range.maximum), displaySizeOfNumber(m_range.minimum)); numberOfDashs; --numberOfDashs) - builder.append('-'); - return builder.toString(); + return m_hasValue ? value() : m_placeholder; } } // namespace WebCore diff --git a/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h b/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h index 28f2b9e49..00eeef024 100644 --- a/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h +++ b/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h @@ -26,7 +26,7 @@ #ifndef DateTimeNumericFieldElement_h #define DateTimeNumericFieldElement_h -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldElement.h" namespace WebCore { @@ -45,14 +45,18 @@ protected: struct Range { Range(int minimum, int maximum); int clampValue(int) const; + bool isInRange(int) const; int maximum; int minimum; }; - DateTimeNumericFieldElement(Document*, FieldOwner&, int minimum, int maximum); + DateTimeNumericFieldElement(Document*, FieldOwner&, int minimum, int maximum, const String& placeholder); int clampValue(int value) const { return m_range.clampValue(value); } + virtual int clampValueForHardLimits(int) const; + virtual int defaultValueForStepDown() const; + virtual int defaultValueForStepUp() const; const Range& range() const { return m_range; } // DateTimeFieldElement functions. @@ -64,6 +68,9 @@ protected: virtual String visibleValue() const OVERRIDE FINAL; private: + // Element function. + virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; + // DateTimeFieldElement functions. virtual void didBlur() OVERRIDE FINAL; virtual void handleKeyboardEvent(KeyboardEvent*) OVERRIDE FINAL; @@ -72,7 +79,11 @@ private: virtual void stepUp() OVERRIDE FINAL; virtual String value() const OVERRIDE FINAL; + String formatValue(int) const; + Localizer& localizerForOwner() const; + DOMTimeStamp m_lastDigitCharTime; + const String m_placeholder; const Range m_range; int m_value; bool m_hasValue; diff --git a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp index 6cb4ec1e2..742208f53 100644 --- a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeSymbolicFieldElement.h" #include "FontCache.h" diff --git a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h index cb0ac1e7b..f1eab8eb4 100644 --- a/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h +++ b/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h @@ -26,7 +26,7 @@ #ifndef DateTimeSymbolicFieldElement_h #define DateTimeSymbolicFieldElement_h -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) #include "DateTimeFieldElement.h" namespace WebCore { diff --git a/Source/WebCore/html/shadow/HTMLContentElement.cpp b/Source/WebCore/html/shadow/HTMLContentElement.cpp index b0bdd885f..912cfdf51 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.cpp +++ b/Source/WebCore/html/shadow/HTMLContentElement.cpp @@ -29,10 +29,10 @@ #include "ContentDistributor.h" #include "ContentSelectorQuery.h" -#include "ContextFeatures.h" #include "ElementShadow.h" #include "HTMLNames.h" #include "QualifiedName.h" +#include "RuntimeEnabledFeatures.h" #include "ShadowRoot.h" #include <wtf/StdLibExtras.h> @@ -43,7 +43,7 @@ using HTMLNames::selectAttr; static const QualifiedName& contentTagName(Document* document) { #if ENABLE(SHADOW_DOM) - if (!ContextFeatures::shadowDOMEnabled(document)) + if (!RuntimeEnabledFeatures::shadowDOMEnabled()) return HTMLNames::webkitShadowContentTag; return HTMLNames::contentTag; #else diff --git a/Source/WebCore/html/shadow/HTMLContentElement.idl b/Source/WebCore/html/shadow/HTMLContentElement.idl index c928d4494..448c979a3 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.idl +++ b/Source/WebCore/html/shadow/HTMLContentElement.idl @@ -24,11 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - interface [ - Conditional=SHADOW_DOM, - V8EnabledAtRuntime=shadowDOM - ] HTMLContentElement : HTMLElement { - attribute [Reflect] DOMString select; - }; -} +[ + Conditional=SHADOW_DOM, + V8EnabledAtRuntime=shadowDOM +] interface HTMLContentElement : HTMLElement { + [Reflect] attribute DOMString select; + attribute boolean resetStyleInheritance; +}; diff --git a/Source/WebCore/html/shadow/HTMLShadowElement.cpp b/Source/WebCore/html/shadow/HTMLShadowElement.cpp index 938439612..5c5dbe94f 100644 --- a/Source/WebCore/html/shadow/HTMLShadowElement.cpp +++ b/Source/WebCore/html/shadow/HTMLShadowElement.cpp @@ -41,6 +41,7 @@ class Document; inline HTMLShadowElement::HTMLShadowElement(const QualifiedName& tagName, Document* document) : InsertionPoint(tagName, document) + , m_registeredWithShadowRoot(false) { ASSERT(hasTagName(HTMLNames::shadowTag)); } @@ -68,4 +69,31 @@ bool HTMLShadowElement::doesSelectFromHostChildren() const return false; } +Node::InsertionNotificationRequest HTMLShadowElement::insertedInto(ContainerNode* insertionPoint) +{ + InsertionPoint::insertedInto(insertionPoint); + + if (insertionPoint->inDocument() && isActive()) { + if (ShadowRoot* root = shadowRoot()) { + root->registerShadowElement(); + m_registeredWithShadowRoot = true; + } + } + + return InsertionDone; +} + +void HTMLShadowElement::removedFrom(ContainerNode* insertionPoint) +{ + if (insertionPoint->inDocument() && m_registeredWithShadowRoot) { + ShadowRoot* root = shadowRoot(); + if (!root) + root = insertionPoint->shadowRoot(); + if (root) + root->unregisterShadowElement(); + m_registeredWithShadowRoot = false; + } + InsertionPoint::removedFrom(insertionPoint); +} + } // namespace WebCore diff --git a/Source/WebCore/html/shadow/HTMLShadowElement.h b/Source/WebCore/html/shadow/HTMLShadowElement.h index a4ecdb3ad..119fa9f95 100644 --- a/Source/WebCore/html/shadow/HTMLShadowElement.h +++ b/Source/WebCore/html/shadow/HTMLShadowElement.h @@ -46,8 +46,14 @@ public: bool isSelectValid() const OVERRIDE { return true; } bool doesSelectFromHostChildren() const; +protected: + virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; + virtual void removedFrom(ContainerNode*) OVERRIDE; + private: HTMLShadowElement(const QualifiedName&, Document*); + + bool m_registeredWithShadowRoot; }; } // namespace WebCore diff --git a/Source/WebCore/html/shadow/HTMLShadowElement.idl b/Source/WebCore/html/shadow/HTMLShadowElement.idl index 94facb7be..b50194503 100644 --- a/Source/WebCore/html/shadow/HTMLShadowElement.idl +++ b/Source/WebCore/html/shadow/HTMLShadowElement.idl @@ -28,12 +28,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { - - interface [ - Conditional=SHADOW_DOM, - V8EnabledAtRuntime=shadowDOM - ] HTMLShadowElement : HTMLElement { - }; - -} +[ + Conditional=SHADOW_DOM, + V8EnabledAtRuntime=shadowDOM +] interface HTMLShadowElement : HTMLElement { + attribute boolean resetStyleInheritance; +}; diff --git a/Source/WebCore/html/shadow/InsertionPoint.cpp b/Source/WebCore/html/shadow/InsertionPoint.cpp index 435796677..7aecaa56e 100644 --- a/Source/WebCore/html/shadow/InsertionPoint.cpp +++ b/Source/WebCore/html/shadow/InsertionPoint.cpp @@ -33,11 +33,13 @@ #include "ElementShadow.h" #include "ShadowRoot.h" +#include "StaticNodeList.h" namespace WebCore { InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document) : HTMLElement(tagName, document) + , m_shouldResetStyleInheritance(false) { } @@ -86,6 +88,19 @@ bool InsertionPoint::isActive() const return true; } +PassRefPtr<NodeList> InsertionPoint::distributedNodes() const +{ + if (!attached()) + return 0; + + Vector<RefPtr<Node> > nodes; + + for (size_t i = 0; i < m_distribution.size(); ++i) + nodes.append(m_distribution.at(i)); + + return StaticNodeList::adopt(nodes); +} + bool InsertionPoint::rendererIsNeeded(const NodeRenderingContext& context) { return !isShadowBoundary() && HTMLElement::rendererIsNeeded(context); @@ -145,4 +160,18 @@ void InsertionPoint::removedFrom(ContainerNode* insertionPoint) HTMLElement::removedFrom(insertionPoint); } +bool InsertionPoint::resetStyleInheritance() const +{ + return m_shouldResetStyleInheritance; +} + +void InsertionPoint::setResetStyleInheritance(bool value) +{ + if (value != m_shouldResetStyleInheritance) { + m_shouldResetStyleInheritance = value; + if (attached() && isActive()) + shadowRoot()->host()->setNeedsStyleRecalc(); + } +} + } // namespace WebCore diff --git a/Source/WebCore/html/shadow/InsertionPoint.h b/Source/WebCore/html/shadow/InsertionPoint.h index 6237de2e6..2ef36c1c5 100644 --- a/Source/WebCore/html/shadow/InsertionPoint.h +++ b/Source/WebCore/html/shadow/InsertionPoint.h @@ -49,10 +49,15 @@ public: bool isShadowBoundary() const; bool isActive() const; + PassRefPtr<NodeList> distributedNodes() const; + virtual const AtomicString& select() const = 0; virtual bool isSelectValid() const = 0; virtual bool doesSelectFromHostChildren() const = 0; + bool resetStyleInheritance() const; + void setResetStyleInheritance(bool); + virtual void attach(); virtual void detach(); virtual bool isInsertionPoint() const OVERRIDE { return true; } @@ -75,6 +80,7 @@ protected: private: ContentDistribution m_distribution; + bool m_shouldResetStyleInheritance : 1; }; inline bool isInsertionPoint(const Node* node) diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index 881c2deb5..7cccd690e 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -261,8 +261,10 @@ void MediaControlPanelElement::makeTransparent() if (!m_opaque) return; + double duration = document()->page() ? document()->page()->theme()->mediaControlsFadeOutDuration() : 0; + setInlineStyleProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); - setInlineStyleProperty(CSSPropertyWebkitTransitionDuration, document()->page()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S); + setInlineStyleProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S); setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBER); m_opaque = false; diff --git a/Source/WebCore/html/shadow/CalendarPickerElement.cpp b/Source/WebCore/html/shadow/PickerIndicatorElement.cpp index 7513f5b71..fa25bd673 100644 --- a/Source/WebCore/html/shadow/CalendarPickerElement.cpp +++ b/Source/WebCore/html/shadow/PickerIndicatorElement.cpp @@ -29,7 +29,7 @@ */ #include "config.h" -#include "CalendarPickerElement.h" +#include "PickerIndicatorElement.h" #if ENABLE(CALENDAR_PICKER) @@ -49,39 +49,39 @@ namespace WebCore { using namespace HTMLNames; -inline CalendarPickerElement::CalendarPickerElement(Document* document) +inline PickerIndicatorElement::PickerIndicatorElement(Document* document) : HTMLDivElement(divTag, document) , m_chooser(nullptr) { setShadowPseudoId("-webkit-calendar-picker-indicator"); } -PassRefPtr<CalendarPickerElement> CalendarPickerElement::create(Document* document) +PassRefPtr<PickerIndicatorElement> PickerIndicatorElement::create(Document* document) { - return adoptRef(new CalendarPickerElement(document)); + return adoptRef(new PickerIndicatorElement(document)); } -CalendarPickerElement::~CalendarPickerElement() +PickerIndicatorElement::~PickerIndicatorElement() { closePopup(); ASSERT(!m_chooser); } -RenderObject* CalendarPickerElement::createRenderer(RenderArena* arena, RenderStyle*) +RenderObject* PickerIndicatorElement::createRenderer(RenderArena* arena, RenderStyle*) { return new (arena) RenderDetailsMarker(this); } -inline HTMLInputElement* CalendarPickerElement::hostInput() +inline HTMLInputElement* PickerIndicatorElement::hostInput() { - // JavaScript code can't create CalendarPickerElement objects. This is + // JavaScript code can't create PickerIndicatorElement objects. This is // always in shadow of <input>. ASSERT(shadowHost()); ASSERT(shadowHost()->hasTagName(inputTag)); return static_cast<HTMLInputElement*>(shadowHost()); } -void CalendarPickerElement::defaultEventHandler(Event* event) +void PickerIndicatorElement::defaultEventHandler(Event* event) { if (!renderer()) return; @@ -98,7 +98,7 @@ void CalendarPickerElement::defaultEventHandler(Event* event) HTMLDivElement::defaultEventHandler(event); } -bool CalendarPickerElement::willRespondToMouseClickEvents() +bool PickerIndicatorElement::willRespondToMouseClickEvents() { const HTMLInputElement* input = hostInput(); if (renderer() && !input->readOnly() && !input->disabled()) @@ -107,17 +107,17 @@ bool CalendarPickerElement::willRespondToMouseClickEvents() return HTMLDivElement::willRespondToMouseClickEvents(); } -void CalendarPickerElement::didChooseValue(const String& value) +void PickerIndicatorElement::didChooseValue(const String& value) { hostInput()->setValue(value, DispatchChangeEvent); } -void CalendarPickerElement::didEndChooser() +void PickerIndicatorElement::didEndChooser() { m_chooser.clear(); } -void CalendarPickerElement::openPopup() +void PickerIndicatorElement::openPopup() { if (m_chooser) return; @@ -135,13 +135,19 @@ void CalendarPickerElement::openPopup() parameters.minimum = input->minimum(); parameters.maximum = input->maximum(); parameters.required = input->required(); - Decimal step; - if (hostInput()->getAllowedValueStep(&step)) + + StepRange stepRange = input->createStepRange(RejectAny); + if (stepRange.hasStep()) { + parameters.step = stepRange.step().toDouble(); + parameters.stepBase = stepRange.stepBase().toDouble(); + } else { parameters.step = 1.0; - else - parameters.step = step.toDouble(); + parameters.stepBase = 0; + } + parameters.anchorRectInRootView = document()->view()->contentsToRootView(hostInput()->pixelSnappedBoundingBox()); parameters.currentValue = input->value(); + parameters.isAnchorElementRTL = input->computedStyle()->direction() == RTL; if (HTMLDataListElement* dataList = input->dataList()) { RefPtr<HTMLCollection> options = dataList->options(); for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options->item(i)); ++i) { @@ -155,14 +161,14 @@ void CalendarPickerElement::openPopup() m_chooser = chrome->client()->openDateTimeChooser(this, parameters); } -void CalendarPickerElement::closePopup() +void PickerIndicatorElement::closePopup() { if (!m_chooser) return; m_chooser->endChooser(); } -void CalendarPickerElement::detach() +void PickerIndicatorElement::detach() { closePopup(); HTMLDivElement::detach(); diff --git a/Source/WebCore/html/shadow/CalendarPickerElement.h b/Source/WebCore/html/shadow/PickerIndicatorElement.h index f90347864..1d891c22a 100644 --- a/Source/WebCore/html/shadow/CalendarPickerElement.h +++ b/Source/WebCore/html/shadow/PickerIndicatorElement.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CalendarPickerElement_h -#define CalendarPickerElement_h +#ifndef PickerIndicatorElement_h +#define PickerIndicatorElement_h #if ENABLE(CALENDAR_PICKER) @@ -43,10 +43,10 @@ namespace WebCore { class HTMLInputElement; class PagePopup; -class CalendarPickerElement : public HTMLDivElement, public DateTimeChooserClient { +class PickerIndicatorElement : public HTMLDivElement, public DateTimeChooserClient { public: - static PassRefPtr<CalendarPickerElement> create(Document*); - virtual ~CalendarPickerElement(); + static PassRefPtr<PickerIndicatorElement> create(Document*); + virtual ~PickerIndicatorElement(); void openPopup(); void closePopup(); virtual bool willRespondToMouseClickEvents() OVERRIDE; @@ -56,7 +56,7 @@ public: virtual void didEndChooser() OVERRIDE; private: - CalendarPickerElement(Document*); + PickerIndicatorElement(Document*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; virtual void defaultEventHandler(Event*) OVERRIDE; virtual void detach() OVERRIDE; diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index d8bbd2bbb..b045e2389 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -40,7 +40,7 @@ #include "HTMLInputElement.h" #include "HTMLParserIdioms.h" #include "MouseEvent.h" -#include "RenderDeprecatedFlexibleBox.h" +#include "RenderFlexibleBox.h" #include "RenderSlider.h" #include "RenderTheme.h" #include "ShadowRoot.h" @@ -121,88 +121,74 @@ bool RenderSliderThumb::isSliderThumb() const return true; } -void RenderSliderThumb::layout() -{ - // Do not cast node() to SliderThumbElement. This renderer is used for - // TrackLimitElement too. - HTMLInputElement* input = node()->shadowHost()->toInputElement(); - bool isVertical = hasVerticalAppearance(input); - - double fraction = (sliderPosition(input) * 100).toDouble(); - if (isVertical) - style()->setTop(Length(100 - fraction, Percent)); - else if (style()->isLeftToRightDirection()) - style()->setLeft(Length(fraction, Percent)); - else - style()->setRight(Length(fraction, Percent)); - - RenderBlock::layout(); -} - // -------------------------------- // FIXME: Find a way to cascade appearance and adjust heights, and get rid of this class. // http://webkit.org/b/62535 -class RenderSliderContainer : public RenderDeprecatedFlexibleBox { +class RenderSliderContainer : public RenderFlexibleBox { public: RenderSliderContainer(Node* node) - : RenderDeprecatedFlexibleBox(node) { } + : RenderFlexibleBox(node) { } +public: + virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; private: - virtual void layout(); + virtual void layout() OVERRIDE; }; -void RenderSliderContainer::layout() +void RenderSliderContainer::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const { HTMLInputElement* input = node()->shadowHost()->toInputElement(); bool isVertical = hasVerticalAppearance(input); - style()->setBoxOrient(isVertical ? VERTICAL : HORIZONTAL); - // Sets the concrete height if the height of the <input> is not fixed or a - // percentage value because a percentage height value of this box won't be - // based on the <input> height in such case. - if (input->renderer()->isSlider()) { - if (!isVertical) { - RenderObject* trackRenderer = node()->firstChild()->renderer(); - Length inputHeight = input->renderer()->style()->height(); - if (!inputHeight.isSpecified()) { - RenderObject* thumbRenderer = input->sliderThumbElement()->renderer(); - if (thumbRenderer) { - Length height = thumbRenderer->style()->height(); + #if ENABLE(DATALIST_ELEMENT) - if (input && input->list()) { - int offsetFromCenter = theme()->sliderTickOffsetFromTrackCenter(); - int trackHeight = 0; - if (offsetFromCenter < 0) - trackHeight = -2 * offsetFromCenter; - else { - int tickLength = theme()->sliderTickSize().height(); - trackHeight = 2 * (offsetFromCenter + tickLength); - } - float zoomFactor = style()->effectiveZoom(); - if (zoomFactor != 1.0) - trackHeight *= zoomFactor; - height = Length(trackHeight, Fixed); - } -#endif - style()->setHeight(height); - } - } else { - style()->setHeight(Length(100, Percent)); - if (trackRenderer) - trackRenderer->style()->setHeight(Length()); - } + if (input->renderer()->isSlider() && !isVertical && input->list()) { + int offsetFromCenter = theme()->sliderTickOffsetFromTrackCenter(); + LayoutUnit trackHeight = 0; + if (offsetFromCenter < 0) + trackHeight = -2 * offsetFromCenter; + else { + int tickLength = theme()->sliderTickSize().height(); + trackHeight = 2 * (offsetFromCenter + tickLength); } + float zoomFactor = style()->effectiveZoom(); + if (zoomFactor != 1.0) + trackHeight *= zoomFactor; + + RenderBox::computeLogicalHeight(trackHeight, logicalTop, computedValues); + return; } +#endif + if (isVertical) + logicalHeight = RenderSlider::defaultTrackLength; + RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues); +} - RenderDeprecatedFlexibleBox::layout(); +void RenderSliderContainer::layout() +{ + HTMLInputElement* input = node()->shadowHost()->toInputElement(); + bool isVertical = hasVerticalAppearance(input); + style()->setFlexDirection(isVertical ? FlowColumn : FlowRow); - // Percentage 'top' for the thumb doesn't work if the parent style has no - // concrete height. - Node* track = node()->firstChild(); - if (track && track->renderer()->isBox()) { - RenderBox* trackBox = track->renderBox(); - trackBox->style()->setHeight(Length(trackBox->height() - trackBox->borderAndPaddingHeight(), Fixed)); - } + RenderFlexibleBox::layout(); + + // These should always exist, unless someone mutates the shadow DOM (e.g., in the inspector). + if (!input->sliderThumbElement() || !input->sliderThumbElement()->renderer()) + return; + RenderBox* thumb = toRenderBox(input->sliderThumbElement()->renderer()); + RenderBox* track = toRenderBox(thumb->parent()); + + double percentageOffset = sliderPosition(input).toDouble(); + LayoutUnit availableExtent = isVertical ? track->contentHeight() : track->contentWidth(); + LayoutUnit offset = percentageOffset * availableExtent; + LayoutPoint thumbLocation = thumb->location(); + if (isVertical) + thumbLocation.setY(thumbLocation.y() + track->contentHeight() - offset); + else if (style()->isLeftToRightDirection()) + thumbLocation.setX(thumbLocation.x() + offset); + else + thumbLocation.setX(thumbLocation.x() - offset); + thumb->setLocation(thumbLocation); } // -------------------------------- @@ -256,7 +242,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) return; input->setTextAsOfLastFormControlChangeEvent(input->value()); - LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true)); + LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, UseTransforms | SnapOffsetForTransforms)); bool isVertical = hasVerticalAppearance(input); bool isLeftToRightDirection = renderBox()->style()->isLeftToRightDirection(); LayoutUnit trackSize; diff --git a/Source/WebCore/html/shadow/SliderThumbElement.h b/Source/WebCore/html/shadow/SliderThumbElement.h index b8912c272..f55ecef3d 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.h +++ b/Source/WebCore/html/shadow/SliderThumbElement.h @@ -111,7 +111,6 @@ public: private: virtual bool isSliderThumb() const; - virtual void layout(); }; // -------------------------------- diff --git a/Source/WebCore/html/shadow/SpinButtonElement.cpp b/Source/WebCore/html/shadow/SpinButtonElement.cpp index e5247c4f3..99dd71947 100644 --- a/Source/WebCore/html/shadow/SpinButtonElement.cpp +++ b/Source/WebCore/html/shadow/SpinButtonElement.cpp @@ -89,7 +89,7 @@ void SpinButtonElement::defaultEventHandler(Event* event) } MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); - IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); + IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms | SnapOffsetForTransforms)); if (mouseEvent->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) { if (box->pixelSnappedBorderBoxRect().contains(local)) { // The following functions of HTMLInputElement may run JavaScript diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp index 689aa0ad2..be085e430 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp @@ -57,6 +57,7 @@ TextFieldDecorator::~TextFieldDecorator() TextFieldDecorationElement::TextFieldDecorationElement(Document* document, TextFieldDecorator* decorator) : HTMLDivElement(HTMLNames::divTag, document) , m_textFieldDecorator(decorator) + , m_isInHoverState(false) { ASSERT(decorator); setHasCustomCallbacks(); @@ -137,6 +138,8 @@ void TextFieldDecorationElement::updateImage() image = m_textFieldDecorator->imageForDisabledState(); else if (hostInput()->readOnly()) image = m_textFieldDecorator->imageForReadonlyState(); + else if (m_isInHoverState) + image = m_textFieldDecorator->imageForHoverState(); else image = m_textFieldDecorator->imageForNormalState(); ASSERT(image); @@ -194,10 +197,29 @@ void TextFieldDecorationElement::defaultEventHandler(Event* event) event->setDefaultHandled(); } + if (event->type() == eventNames().mouseoverEvent) { + m_isInHoverState = true; + updateImage(); + } + + if (event->type() == eventNames().mouseoutEvent) { + m_isInHoverState = false; + updateImage(); + } + if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); } +bool TextFieldDecorationElement::willRespondToMouseMoveEvents() +{ + const HTMLInputElement* input = hostInput(); + if (!input->disabled() && !input->readOnly()) + return true; + + return HTMLDivElement::willRespondToMouseMoveEvents(); +} + bool TextFieldDecorationElement::willRespondToMouseClickEvents() { const HTMLInputElement* input = hostInput(); diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.h b/Source/WebCore/html/shadow/TextFieldDecorationElement.h index 2c8d822b3..fd5a2c495 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.h +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.h @@ -52,6 +52,7 @@ public: virtual CachedImage* imageForNormalState() = 0; virtual CachedImage* imageForDisabledState() = 0; virtual CachedImage* imageForReadonlyState() = 0; + virtual CachedImage* imageForHoverState() = 0; virtual void handleClick(HTMLInputElement*) = 0; // This function is called just before detaching the decoration. It must not @@ -71,6 +72,7 @@ public: TextFieldDecorator* textFieldDecorator() { return m_textFieldDecorator; } void decorate(HTMLInputElement*, bool visible); + virtual bool willRespondToMouseMoveEvents() OVERRIDE; virtual bool willRespondToMouseClickEvents() OVERRIDE; private: @@ -87,6 +89,7 @@ private: void updateImage(); TextFieldDecorator* m_textFieldDecorator; + bool m_isInHoverState; }; inline TextFieldDecorationElement* toTextFieldDecorationElement(Node* node) diff --git a/Source/WebCore/html/track/TextTrack.cpp b/Source/WebCore/html/track/TextTrack.cpp index 6abcaccd8..120fce79c 100644 --- a/Source/WebCore/html/track/TextTrack.cpp +++ b/Source/WebCore/html/track/TextTrack.cpp @@ -100,7 +100,7 @@ TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, c , m_mediaElement(0) , m_label(label) , m_language(language) - , m_mode(disabledKeyword()) + , m_mode(disabledKeyword().string()) , m_client(client) , m_trackType(type) , m_readinessState(NotLoaded) diff --git a/Source/WebCore/html/track/TextTrack.idl b/Source/WebCore/html/track/TextTrack.idl index 9836f02ce..e6465a7af 100644 --- a/Source/WebCore/html/track/TextTrack.idl +++ b/Source/WebCore/html/track/TextTrack.idl @@ -23,38 +23,35 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=VIDEO_TRACK, + V8EnabledAtRuntime=webkitVideoTrack, + EventTarget, + JSCustomMarkFunction, + JSCustomIsReachable +] interface TextTrack { + readonly attribute DOMString kind; + readonly attribute DOMString label; + readonly attribute DOMString language; - interface [ - Conditional=VIDEO_TRACK, - V8EnabledAtRuntime=webkitVideoTrack, - EventTarget, - JSCustomMarkFunction, - JSCustomIsReachable - ] TextTrack { - readonly attribute DOMString kind; - readonly attribute DOMString label; - readonly attribute DOMString language; + attribute DOMString mode; - attribute DOMString mode; + readonly attribute TextTrackCueList cues; + readonly attribute TextTrackCueList activeCues; + attribute EventListener oncuechange; - readonly attribute TextTrackCueList cues; - readonly attribute TextTrackCueList activeCues; - attribute EventListener oncuechange; + void addCue(in TextTrackCue cue) + raises (DOMException); + void removeCue(in TextTrackCue cue) + raises (DOMException); - void addCue(in TextTrackCue cue) - raises (DOMException); - void removeCue(in TextTrackCue cue) - raises (DOMException); - - // EventTarget interface - void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - void removeEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) - raises(EventException); - }; -} + // EventTarget interface + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); +}; diff --git a/Source/WebCore/html/track/TextTrackCue.idl b/Source/WebCore/html/track/TextTrackCue.idl index 040110963..ddb67e44e 100644 --- a/Source/WebCore/html/track/TextTrackCue.idl +++ b/Source/WebCore/html/track/TextTrackCue.idl @@ -23,52 +23,49 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=VIDEO_TRACK, + V8EnabledAtRuntime=webkitVideoTrack, + JSGenerateToNativeObject, + Constructor(in double startTime, in double endTime, in DOMString text), + CallWith=ScriptExecutionContext, + EventTarget, + JSCustomMarkFunction, + JSCustomIsReachable +] interface TextTrackCue { + readonly attribute TextTrack track; - interface [ - Conditional=VIDEO_TRACK, - V8EnabledAtRuntime=webkitVideoTrack, - JSGenerateToNativeObject, - Constructor(in double startTime, in double endTime, in DOMString text), - CallWith=ScriptExecutionContext, - EventTarget, - JSCustomMarkFunction, - JSCustomIsReachable - ] TextTrackCue { - readonly attribute TextTrack track; + attribute DOMString id; + attribute double startTime; + attribute double endTime; + attribute boolean pauseOnExit; - attribute DOMString id; - attribute double startTime; - attribute double endTime; - attribute boolean pauseOnExit; + attribute DOMString vertical + setter raises (DOMException); + attribute boolean snapToLines; + attribute long line + setter raises (DOMException); + attribute long position + setter raises (DOMException); + attribute long size + setter raises (DOMException); + attribute DOMString align + setter raises (DOMException); - attribute DOMString vertical - setter raises (DOMException); - attribute boolean snapToLines; - attribute long line - setter raises (DOMException); - attribute long position - setter raises (DOMException); - attribute long size - setter raises (DOMException); - attribute DOMString align - setter raises (DOMException); + attribute DOMString text; + DocumentFragment getCueAsHTML(); + + attribute EventListener onenter; + attribute EventListener onexit; + + // EventTarget interface + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); +}; - attribute DOMString text; - DocumentFragment getCueAsHTML(); - - attribute EventListener onenter; - attribute EventListener onexit; - - // EventTarget interface - void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - void removeEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) - raises(EventException); - }; - -} diff --git a/Source/WebCore/html/track/TextTrackCueList.idl b/Source/WebCore/html/track/TextTrackCueList.idl index 380e59a31..dab976c56 100644 --- a/Source/WebCore/html/track/TextTrackCueList.idl +++ b/Source/WebCore/html/track/TextTrackCueList.idl @@ -23,16 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=VIDEO_TRACK, + V8EnabledAtRuntime=webkitVideoTrack, + IndexedGetter +] interface TextTrackCueList { + readonly attribute unsigned long length; + TextTrackCue item(in unsigned long index); + TextTrackCue getCueById(in DOMString id); +}; - interface [ - Conditional=VIDEO_TRACK, - V8EnabledAtRuntime=webkitVideoTrack, - IndexedGetter - ] TextTrackCueList { - readonly attribute unsigned long length; - TextTrackCue item(in unsigned long index); - TextTrackCue getCueById(in DOMString id); - }; - -} diff --git a/Source/WebCore/html/track/TextTrackList.idl b/Source/WebCore/html/track/TextTrackList.idl index ad4e8621c..0b0e45016 100644 --- a/Source/WebCore/html/track/TextTrackList.idl +++ b/Source/WebCore/html/track/TextTrackList.idl @@ -23,30 +23,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=VIDEO_TRACK, + V8EnabledAtRuntime=webkitVideoTrack, + IndexedGetter, + EventTarget, + JSCustomMarkFunction, + JSCustomIsReachable, + V8GenerateIsReachable=ImplOwnerRoot +] interface TextTrackList { + readonly attribute unsigned long length; + TextTrack item(in unsigned long index); - interface [ - Conditional=VIDEO_TRACK, - V8EnabledAtRuntime=webkitVideoTrack, - IndexedGetter, - EventTarget, - JSCustomMarkFunction, - JSCustomIsReachable, - V8GenerateIsReachable=ImplOwnerRoot - ] TextTrackList { - readonly attribute unsigned long length; - TextTrack item(in unsigned long index); + attribute EventListener onaddtrack; - attribute EventListener onaddtrack; + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); +}; - void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - void removeEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) - raises(EventException); - }; - -} diff --git a/Source/WebCore/html/track/TrackEvent.idl b/Source/WebCore/html/track/TrackEvent.idl index b475ad41a..59b5ca6c6 100644 --- a/Source/WebCore/html/track/TrackEvent.idl +++ b/Source/WebCore/html/track/TrackEvent.idl @@ -23,14 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -module html { +[ + Conditional=VIDEO_TRACK, + V8EnabledAtRuntime=webkitVideoTrack, + ConstructorTemplate=Event +] interface TrackEvent : Event { + [InitializedByEventConstructor, CustomGetter] readonly attribute object track; +}; - interface [ - Conditional=VIDEO_TRACK, - V8EnabledAtRuntime=webkitVideoTrack, - ConstructorTemplate=Event - ] TrackEvent : Event { - readonly attribute [InitializedByEventConstructor, CustomGetter] object track; - }; - -} diff --git a/Source/WebCore/html/track/WebVTTTokenizer.cpp b/Source/WebCore/html/track/WebVTTTokenizer.cpp index e45f1ed6d..4d2d8b300 100644 --- a/Source/WebCore/html/track/WebVTTTokenizer.cpp +++ b/Source/WebCore/html/track/WebVTTTokenizer.cpp @@ -52,13 +52,16 @@ inline bool MarkupTokenizerBase<WebVTTToken, WebVTTTokenizerState>::shouldSkipNu return true; } -inline bool vectorEqualsString(const Vector<UChar, 32>& vector, const String& string) +template <typename CharacterType> +inline bool vectorEqualsString(const Vector<CharacterType, 32>& vector, const String& string) { if (vector.size() != string.length()) return false; - const UChar* stringData = string.characters(); - const UChar* vectorData = vector.data(); - return !memcmp(stringData, vectorData, vector.size() * sizeof(UChar)); + + if (!string.length()) + return true; + + return equal(string.impl(), vector.data(), vector.size()); } void WebVTTTokenizer::reset() @@ -84,11 +87,11 @@ bool WebVTTTokenizer::nextToken(SegmentedString& source, WebVTTToken& token) switch (m_state) { WEBVTT_BEGIN_STATE(DataState) { if (cc == '&') { - m_buffer.append(cc); + m_buffer.append(static_cast<LChar>(cc)); WEBVTT_ADVANCE_TO(EscapeState); } else if (cc == '<') { if (m_token->type() == WebVTTTokenTypes::Uninitialized - || vectorEqualsString(m_token->characters(), emptyString())) + || vectorEqualsString<UChar>(m_token->characters(), emptyString())) WEBVTT_ADVANCE_TO(TagState); else return emitAndResumeIn(source, WebVTTTokenizerState::TagState); @@ -110,13 +113,13 @@ bool WebVTTTokenizer::nextToken(SegmentedString& source, WebVTTToken& token) else if (vectorEqualsString(m_buffer, ">")) bufferCharacter('>'); else { - m_buffer.append(cc); + m_buffer.append(static_cast<LChar>(cc)); m_token->appendToCharacter(m_buffer); } m_buffer.clear(); WEBVTT_ADVANCE_TO(DataState); } else if (isASCIIAlphanumeric(cc)) { - m_buffer.append(cc); + m_buffer.append(static_cast<LChar>(cc)); WEBVTT_ADVANCE_TO(EscapeState); } else if (cc == InputStreamPreprocessor::endOfFileMarker) { m_token->appendToCharacter(m_buffer); diff --git a/Source/WebCore/html/track/WebVTTTokenizer.h b/Source/WebCore/html/track/WebVTTTokenizer.h index e6d45f7ff..0f45bfd0e 100644 --- a/Source/WebCore/html/track/WebVTTTokenizer.h +++ b/Source/WebCore/html/track/WebVTTTokenizer.h @@ -67,7 +67,7 @@ public: private: WebVTTTokenizer(); - Vector<UChar, 32> m_buffer; + Vector<LChar, 32> m_buffer; }; } |