diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-25 13:02:02 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-25 13:02:02 +0200 |
commit | 715be629d51174233403237bfc563cf150087dc8 (patch) | |
tree | 4cff72df808db977624338b0a38d8b6d1bd73c57 /Source/WebCore/html | |
parent | dc6262b587c71c14e30d93e57ed812e36a79a33e (diff) |
Imported WebKit commit ce614b0924ba46f78d4435e28ff93c8525fbb7cc (http://svn.webkit.org/repository/webkit/trunk@129485)
New snapshot that includes MingW build fixes
Diffstat (limited to 'Source/WebCore/html')
-rw-r--r-- | Source/WebCore/html/DateTimeFieldsState.cpp | 7 | ||||
-rw-r--r-- | Source/WebCore/html/DateTimeFieldsState.h | 3 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLLinkElement.cpp | 15 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLQuoteElement.cpp | 3 | ||||
-rw-r--r-- | Source/WebCore/html/HTMLViewSourceDocument.cpp | 3 | ||||
-rw-r--r-- | Source/WebCore/html/TimeInputType.cpp | 24 | ||||
-rw-r--r-- | Source/WebCore/html/TimeInputType.h | 1 | ||||
-rw-r--r-- | Source/WebCore/html/parser/HTMLTreeBuilder.cpp | 4 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/DateTimeEditElement.cpp | 21 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/DateTimeEditElement.h | 3 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/DateTimeFieldElement.cpp | 5 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/DateTimeFieldElement.h | 2 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/DateTimeFieldElements.cpp | 26 | ||||
-rw-r--r-- | Source/WebCore/html/shadow/DateTimeFieldElements.h | 5 | ||||
-rw-r--r-- | Source/WebCore/html/track/TextTrackCue.cpp | 3 |
15 files changed, 55 insertions, 70 deletions
diff --git a/Source/WebCore/html/DateTimeFieldsState.cpp b/Source/WebCore/html/DateTimeFieldsState.cpp index 8e2bd6c1c..990389dc4 100644 --- a/Source/WebCore/html/DateTimeFieldsState.cpp +++ b/Source/WebCore/html/DateTimeFieldsState.cpp @@ -67,6 +67,13 @@ DateTimeFieldsState::DateTimeFieldsState() { } +unsigned DateTimeFieldsState::hour23() const +{ + if (!hasHour() || !hasAMPM()) + return emptyValue; + return (m_hour % 12) + (m_ampm == AMPMValuePM ? 12 : 0); +} + DateTimeFieldsState DateTimeFieldsState::restoreFormControlState(const FormControlState& state) { DateTimeFieldsState dateTimeFieldsState; diff --git a/Source/WebCore/html/DateTimeFieldsState.h b/Source/WebCore/html/DateTimeFieldsState.h index b6240629e..6fb444071 100644 --- a/Source/WebCore/html/DateTimeFieldsState.h +++ b/Source/WebCore/html/DateTimeFieldsState.h @@ -57,6 +57,7 @@ public: AMPMValue ampm() const { return m_ampm; } unsigned dayOfMonth() const { return m_dayOfMonth; } unsigned hour() const { return m_hour; } + unsigned hour23() const; unsigned millisecond() const { return m_millisecond; } unsigned minute() const { return m_minute; } unsigned month() const { return m_month; } @@ -88,7 +89,7 @@ private: unsigned m_year; unsigned m_month; unsigned m_dayOfMonth; - unsigned m_hour; + unsigned m_hour; // 1 to 12. unsigned m_minute; unsigned m_second; unsigned m_millisecond; diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp index d2868b610..fdc7a5cce 100644 --- a/Source/WebCore/html/HTMLLinkElement.cpp +++ b/Source/WebCore/html/HTMLLinkElement.cpp @@ -30,6 +30,7 @@ #include "CachedResource.h" #include "CachedResourceLoader.h" #include "Document.h" +#include "DocumentStyleSheetCollection.h" #include "EventSender.h" #include "Frame.h" #include "FrameLoader.h" @@ -87,7 +88,7 @@ HTMLLinkElement::~HTMLLinkElement() m_cachedSheet->removeClient(this); if (inDocument()) - document()->removeStyleSheetCandidateNode(this); + document()->styleSheetCollection()->removeStyleSheetCandidateNode(this); linkLoadEventSender().cancelEvent(this); } @@ -254,7 +255,7 @@ Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(ContainerNode* if (m_isInShadowTree) return InsertionDone; - document()->addStyleSheetCandidateNode(this, m_createdByParser); + document()->styleSheetCollection()->addStyleSheetCandidateNode(this, m_createdByParser); process(); return InsertionDone; @@ -272,7 +273,7 @@ void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint) ASSERT(!m_sheet); return; } - document()->removeStyleSheetCandidateNode(this); + document()->styleSheetCollection()->removeStyleSheetCandidateNode(this); if (m_sheet) clearSheet(); @@ -455,7 +456,7 @@ void HTMLLinkElement::addPendingSheet(PendingSheetType type) if (m_pendingSheetType == NonBlocking) return; - document()->addPendingSheet(); + document()->styleSheetCollection()->addPendingSheet(); } void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType notification) @@ -471,10 +472,10 @@ void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType noti return; } - document()->removePendingSheet( + document()->styleSheetCollection()->removePendingSheet( notification == RemovePendingSheetNotifyImmediately - ? Document::RemovePendingSheetNotifyImmediately - : Document::RemovePendingSheetNotifyLater); + ? DocumentStyleSheetCollection::RemovePendingSheetNotifyImmediately + : DocumentStyleSheetCollection::RemovePendingSheetNotifyLater); } DOMSettableTokenList* HTMLLinkElement::sizes() const diff --git a/Source/WebCore/html/HTMLQuoteElement.cpp b/Source/WebCore/html/HTMLQuoteElement.cpp index 05a33ab5e..d5be2f2f7 100644 --- a/Source/WebCore/html/HTMLQuoteElement.cpp +++ b/Source/WebCore/html/HTMLQuoteElement.cpp @@ -24,6 +24,7 @@ #include "HTMLQuoteElement.h" #include "Document.h" +#include "DocumentStyleSheetCollection.h" #include "HTMLNames.h" namespace WebCore { @@ -44,7 +45,7 @@ PassRefPtr<HTMLQuoteElement> HTMLQuoteElement::create(const QualifiedName& tagNa Node::InsertionNotificationRequest HTMLQuoteElement::insertedInto(ContainerNode* insertionPoint) { if (hasTagName(qTag)) - document()->setUsesBeforeAfterRules(true); + document()->styleSheetCollection()->setUsesBeforeAfterRulesOverride(true); return HTMLElement::insertedInto(insertionPoint); } diff --git a/Source/WebCore/html/HTMLViewSourceDocument.cpp b/Source/WebCore/html/HTMLViewSourceDocument.cpp index 3de813770..a4da71a25 100644 --- a/Source/WebCore/html/HTMLViewSourceDocument.cpp +++ b/Source/WebCore/html/HTMLViewSourceDocument.cpp @@ -27,6 +27,7 @@ #include "Attribute.h" #include "DOMImplementation.h" +#include "DocumentStyleSheetCollection.h" #include "HTMLAnchorElement.h" #include "HTMLBRElement.h" #include "HTMLBaseElement.h" @@ -52,7 +53,7 @@ HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, co : HTMLDocument(frame, url) , m_type(mimeType) { - setUsesBeforeAfterRules(true); + styleSheetCollection()->setUsesBeforeAfterRulesOverride(true); setIsViewSource(true); setCompatibilityMode(QuirksMode); diff --git a/Source/WebCore/html/TimeInputType.cpp b/Source/WebCore/html/TimeInputType.cpp index 4b5bb1f15..a0051513a 100644 --- a/Source/WebCore/html/TimeInputType.cpp +++ b/Source/WebCore/html/TimeInputType.cpp @@ -48,6 +48,7 @@ #include "KeyboardEvent.h" #include "Localizer.h" #include "ShadowRoot.h" +#include <wtf/text/WTFString.h> #endif namespace WebCore { @@ -149,13 +150,32 @@ void TimeInputType::DateTimeEditControlOwnerImpl::didFocusOnControl() void TimeInputType::DateTimeEditControlOwnerImpl::editControlValueChanged() { RefPtr<HTMLInputElement> input(m_timeInputType.element()); - input->setValueInternal(m_timeInputType.serialize(Decimal::fromDouble(m_timeInputType.m_dateTimeEditElement->valueAsDouble())), DispatchNoEvent); + input->setValueInternal(m_timeInputType.m_dateTimeEditElement->value(), DispatchNoEvent); input->setNeedsStyleRecalc(); input->dispatchFormControlInputEvent(); input->dispatchFormControlChangeEvent(); input->notifyFormStateChanged(); } + +String TimeInputType::DateTimeEditControlOwnerImpl::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const +{ + if (!dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM()) + return emptyString(); + if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond()) + return String::format("%02u:%02u:%02u.%03u", + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute(), + dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0, + dateTimeFieldsState.millisecond()); + if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second()) + return String::format("%02u:%02u:%02u", + dateTimeFieldsState.hour23(), + dateTimeFieldsState.minute(), + dateTimeFieldsState.second()); + return String::format("%02u:%02u", dateTimeFieldsState.hour23(), dateTimeFieldsState.minute()); +} + bool TimeInputType::hasCustomFocusLogic() const { return false; @@ -271,7 +291,7 @@ void TimeInputType::restoreFormControlState(const FormControlState& state) setMillisecondToDateComponents(createStepRange(AnyIsDefaultStep).minimum().toDouble(), &date); DateTimeFieldsState dateTimeFieldsState = DateTimeFieldsState::restoreFormControlState(state); m_dateTimeEditElement->setValueAsDateTimeFieldsState(dateTimeFieldsState, date); - element()->setValueInternal(serialize(Decimal::fromDouble(m_dateTimeEditElement->valueAsDouble())), DispatchNoEvent); + element()->setValueInternal(m_dateTimeEditElement->value(), DispatchNoEvent); } FormControlState TimeInputType::saveFormControlState() const diff --git a/Source/WebCore/html/TimeInputType.h b/Source/WebCore/html/TimeInputType.h index 0787c3a21..59e272102 100644 --- a/Source/WebCore/html/TimeInputType.h +++ b/Source/WebCore/html/TimeInputType.h @@ -71,6 +71,7 @@ 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; diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 131cdbff6..940800ef8 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -686,9 +686,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token) } if (!m_framesetOk) return; - ExceptionCode ec = 0; - m_tree.openElements()->bodyElement()->remove(ec); - ASSERT(!ec); + m_tree.openElements()->bodyElement()->remove(ASSERT_NO_EXCEPTION); m_tree.openElements()->popUntil(m_tree.openElements()->bodyElement()); m_tree.openElements()->popHTMLBodyElement(); ASSERT(m_tree.openElements()->top() == m_tree.openElements()->htmlElement()); diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp index 07befd874..ad4870ca8 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp @@ -450,6 +450,13 @@ void DateTimeEditElement::updateUIState() } } +String DateTimeEditElement::value() const +{ + if (!m_editControlOwner) + return emptyString(); + return m_editControlOwner->formatDateTimeFieldsState(valueAsDateTimeFieldsState()); +} + DateTimeFieldsState DateTimeEditElement::valueAsDateTimeFieldsState() const { DateTimeFieldsState dateTimeFieldsState; @@ -458,20 +465,6 @@ DateTimeFieldsState DateTimeEditElement::valueAsDateTimeFieldsState() const return dateTimeFieldsState; } -double DateTimeEditElement::valueAsDouble() const -{ - double value = 0; - - for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { - const DateTimeFieldElement* const field = m_fields[fieldIndex]; - if (!field->hasValue()) - return std::numeric_limits<double>::quiet_NaN(); - value += field->valueAsDouble(); - } - - return value; -} - } // namespace WebCore #endif diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.h b/Source/WebCore/html/shadow/DateTimeEditElement.h index e547cbdea..84cf229c6 100644 --- a/Source/WebCore/html/shadow/DateTimeEditElement.h +++ b/Source/WebCore/html/shadow/DateTimeEditElement.h @@ -55,6 +55,7 @@ public: virtual void didBlurFromControl() = 0; virtual void didFocusOnControl() = 0; virtual void editControlValueChanged() = 0; + virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const = 0; virtual bool isEditControlOwnerDisabled() const = 0; virtual bool isEditControlOwnerReadOnly() const = 0; }; @@ -88,8 +89,8 @@ public: void setEmptyValue(const LayoutParameters&, const DateComponents& dateForReadOnlyField); void setValueAsDate(const LayoutParameters&, const DateComponents&); void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField); + String value() const; DateTimeFieldsState valueAsDateTimeFieldsState() const; - double valueAsDouble() const; private: static const size_t invalidFieldIndex = static_cast<size_t>(-1); diff --git a/Source/WebCore/html/shadow/DateTimeFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeFieldElement.cpp index 74817570a..a0ec51e59 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElement.cpp +++ b/Source/WebCore/html/shadow/DateTimeFieldElement.cpp @@ -186,11 +186,6 @@ void DateTimeFieldElement::updateVisibleValue(EventBehavior eventBehavior) m_fieldOwner->fieldValueChanged(); } -double DateTimeFieldElement::valueAsDouble() const -{ - return hasValue() ? valueAsInteger() * unitInMillisecond() : std::numeric_limits<double>::quiet_NaN(); -} - } // namespace WebCore #endif diff --git a/Source/WebCore/html/shadow/DateTimeFieldElement.h b/Source/WebCore/html/shadow/DateTimeFieldElement.h index e8d25cf91..f5c9810a1 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElement.h +++ b/Source/WebCore/html/shadow/DateTimeFieldElement.h @@ -70,7 +70,6 @@ public: virtual void stepDown() = 0; virtual void stepUp() = 0; virtual String value() const = 0; - double valueAsDouble() const; virtual int valueAsInteger() const = 0; virtual String visibleValue() const = 0; @@ -83,7 +82,6 @@ protected: void initialize(const AtomicString& shadowPseudoId, const String& axHelpText); virtual int maximum() const = 0; virtual int minimum() const = 0; - virtual double unitInMillisecond() const = 0; void updateVisibleValue(EventBehavior); private: diff --git a/Source/WebCore/html/shadow/DateTimeFieldElements.cpp b/Source/WebCore/html/shadow/DateTimeFieldElements.cpp index 2016c69a8..c2f458a21 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElements.cpp +++ b/Source/WebCore/html/shadow/DateTimeFieldElements.cpp @@ -30,7 +30,6 @@ #include "DateComponents.h" #include "DateTimeFieldsState.h" #include "LocalizedStrings.h" -#include <wtf/DateMath.h> namespace WebCore { @@ -68,11 +67,6 @@ void DateTimeAMPMFieldElement::setValueAsDateTimeFieldsState(const DateTimeField setEmptyValue(dateForReadOnlyField); } -double DateTimeAMPMFieldElement::unitInMillisecond() const -{ - return msPerHour * 12; -} - // ---------------------------- DateTimeHourFieldElement::DateTimeHourFieldElement(Document* document, FieldOwner& fieldOwner, int minimum, int maximum) @@ -173,11 +167,6 @@ void DateTimeHourFieldElement::setValueAsInteger(int valueAsHour23, EventBehavio DateTimeNumericFieldElement::setValueAsInteger(range().minimum && !value ? m_alignment : value, eventBehavior); } -double DateTimeHourFieldElement::unitInMillisecond() const -{ - return msPerHour; -} - int DateTimeHourFieldElement::valueAsInteger() const { return hasValue() ? DateTimeNumericFieldElement::valueAsInteger() % m_alignment : -1; @@ -224,11 +213,6 @@ void DateTimeMillisecondFieldElement::setValueAsDateTimeFieldsState(const DateTi setValueAsInteger(value); } -double DateTimeMillisecondFieldElement::unitInMillisecond() const -{ - return 1; -} - // ---------------------------- DateTimeMinuteFieldElement::DateTimeMinuteFieldElement(Document* document, FieldOwner& fieldOwner) @@ -270,11 +254,6 @@ void DateTimeMinuteFieldElement::setValueAsDateTimeFieldsState(const DateTimeFie setValueAsInteger(value); } -double DateTimeMinuteFieldElement::unitInMillisecond() const -{ - return msPerMinute; -} - // ---------------------------- DateTimeSecondFieldElement::DateTimeSecondFieldElement(Document* document, FieldOwner& fieldOwner) @@ -316,11 +295,6 @@ void DateTimeSecondFieldElement::setValueAsDateTimeFieldsState(const DateTimeFie setValueAsInteger(value); } -double DateTimeSecondFieldElement::unitInMillisecond() const -{ - return msPerSecond; -} - } // namespace WebCore #endif diff --git a/Source/WebCore/html/shadow/DateTimeFieldElements.h b/Source/WebCore/html/shadow/DateTimeFieldElements.h index e141f838f..23f3403ea 100644 --- a/Source/WebCore/html/shadow/DateTimeFieldElements.h +++ b/Source/WebCore/html/shadow/DateTimeFieldElements.h @@ -45,7 +45,6 @@ private: virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; - virtual double unitInMillisecond() const OVERRIDE FINAL; }; @@ -69,7 +68,6 @@ private: virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRIDE FINAL; - virtual double unitInMillisecond() const OVERRIDE FINAL; virtual int valueAsInteger() const OVERRIDE FINAL; const int m_alignment; @@ -88,7 +86,6 @@ private: virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; - virtual double unitInMillisecond() const OVERRIDE FINAL; }; class DateTimeMinuteFieldElement : public DateTimeNumericFieldElement { @@ -104,7 +101,6 @@ private: virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; - virtual double unitInMillisecond() const OVERRIDE FINAL; }; class DateTimeSecondFieldElement : public DateTimeNumericFieldElement { @@ -120,7 +116,6 @@ private: virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL; virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL; virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL; - virtual double unitInMillisecond() const OVERRIDE FINAL; }; } // namespace WebCore diff --git a/Source/WebCore/html/track/TextTrackCue.cpp b/Source/WebCore/html/track/TextTrackCue.cpp index 299fc1b7c..2fd4f1d4b 100644 --- a/Source/WebCore/html/track/TextTrackCue.cpp +++ b/Source/WebCore/html/track/TextTrackCue.cpp @@ -742,8 +742,7 @@ PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree() void TextTrackCue::removeDisplayTree() { - if (m_displayTree->parentNode()) - m_displayTree->remove(ASSERT_NO_EXCEPTION); + m_displayTree->remove(ASSERT_NO_EXCEPTION); } std::pair<double, double> TextTrackCue::getPositionCoordinates() const |