Chromium Code Reviews| Index: Source/core/testing/Internals.cpp |
| diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
| index 815d0704327cc786d37921cbd6c8b59a35c2f4e1..9ecd77b0ec105d89c826496079351848d4b13349 100644 |
| --- a/Source/core/testing/Internals.cpp |
| +++ b/Source/core/testing/Internals.cpp |
| @@ -196,7 +196,7 @@ void Internals::resetToConsistentState(Page* page) |
| page->setPageScaleFactor(1, IntPoint(0, 0)); |
| page->setPagination(Pagination()); |
| TextRun::setAllowsRoundingHacks(false); |
| - WebCore::overrideUserPreferredLanguages(Vector<String>()); |
| + WebCore::overrideUserPreferredLanguages(Vector<AtomicString>()); |
| delete s_pagePopupDriver; |
| s_pagePopupDriver = 0; |
| page->chrome().client().resetPagePopupDriver(); |
| @@ -380,7 +380,7 @@ Node* Internals::parentTreeScope(Node* node, ExceptionState& exceptionState) |
| return parentTreeScope ? parentTreeScope->rootNode() : 0; |
| } |
| -bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, ExceptionState& exceptionState) |
| +bool Internals::hasSelectorForIdInShadow(Element* host, const AtomicString& idValue, ExceptionState& exceptionState) |
| { |
| if (!host || !host->shadow()) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| @@ -390,7 +390,7 @@ bool Internals::hasSelectorForIdInShadow(Element* host, const String& idValue, E |
| return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue); |
| } |
| -bool Internals::hasSelectorForClassInShadow(Element* host, const String& className, ExceptionState& exceptionState) |
| +bool Internals::hasSelectorForClassInShadow(Element* host, const AtomicString& className, ExceptionState& exceptionState) |
| { |
| if (!host || !host->shadow()) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| @@ -400,7 +400,7 @@ bool Internals::hasSelectorForClassInShadow(Element* host, const String& classNa |
| return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(className); |
| } |
| -bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionState& exceptionState) |
| +bool Internals::hasSelectorForAttributeInShadow(Element* host, const AtomicString& attributeName, ExceptionState& exceptionState) |
| { |
| if (!host || !host->shadow()) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| @@ -678,17 +678,17 @@ String Internals::shadowRootType(const Node* root, ExceptionState& exceptionStat |
| } |
| } |
| -String Internals::shadowPseudoId(Element* element, ExceptionState& exceptionState) |
| +const AtomicString& Internals::shadowPseudoId(Element* element, ExceptionState& exceptionState) |
| { |
| if (!element) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| - return String(); |
| + return nullAtom; |
| } |
| - return element->shadowPseudoId().string(); |
| + return element->shadowPseudoId(); |
| } |
| -void Internals::setShadowPseudoId(Element* element, const String& id, ExceptionState& exceptionState) |
| +void Internals::setShadowPseudoId(Element* element, const AtomicString& id, ExceptionState& exceptionState) |
| { |
| if (!element) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError); |
| @@ -712,7 +712,10 @@ void Internals::selectColorInColorChooser(Element* element, const String& colorV |
| { |
| if (!element->hasTagName(inputTag)) |
| return; |
| - toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); |
| + Color color; |
| + if (!color.setFromString(colorValue)) |
| + return; |
| + toHTMLInputElement(element)->selectColorInColorChooser(color); |
| } |
| Vector<String> Internals::formControlStateOfHistoryItem(ExceptionState& exceptionState) |
| @@ -1016,12 +1019,19 @@ String Internals::suggestedValue(Element* element, ExceptionState& exceptionStat |
| return String(); |
| } |
| - if (!element->hasTagName(inputTag)) { |
| + if (!element->isFormControlElement()) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); |
| return String(); |
| } |
| - return toHTMLInputElement(element)->suggestedValue(); |
| + String suggestedValue; |
| + if (element->hasTagName(inputTag)) |
| + suggestedValue = toHTMLInputElement(element)->suggestedValue(); |
| + |
| + // FIXME: We should be using hasTagName instead but Windows port doesn't link QualifiedNames properly. |
|
tkent
2014/01/06 23:29:49
What do you mean? Why don't you use hasTagName(te
ziran.sun
2014/01/07 17:18:26
I noticed this comment in Internals::wasLastChange
tkent
2014/01/08 00:59:38
I don't think we have such problem now. Probably
ziran.sun
2014/01/08 10:45:54
Done.
|
| + if (element->tagName() == "TEXTAREA") |
| + suggestedValue = toHTMLTextAreaElement(element)->suggestedValue(); |
| + return suggestedValue; |
| } |
| void Internals::setSuggestedValue(Element* element, const String& value, ExceptionState& exceptionState) |
| @@ -1031,12 +1041,17 @@ void Internals::setSuggestedValue(Element* element, const String& value, Excepti |
| return; |
| } |
| - if (!element->hasTagName(inputTag)) { |
| + if (!element->isFormControlElement()) { |
| exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeError); |
| return; |
| } |
| - toHTMLInputElement(element)->setSuggestedValue(value); |
| + if (element->hasTagName(inputTag)) |
| + toHTMLInputElement(element)->setSuggestedValue(value); |
| + |
| + // FIXME: We should be using hasTagName instead but Windows port doesn't link QualifiedNames properly. |
| + if (element->tagName() == "TEXTAREA") |
| + toHTMLTextAreaElement(element)->setSuggestedValue(value); |
| } |
| void Internals::setEditingValue(Element* element, const String& value, ExceptionState& exceptionState) |
| @@ -1259,14 +1274,19 @@ int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionStat |
| return requester->lastProcessedSequence(); |
| } |
| -Vector<String> Internals::userPreferredLanguages() const |
| +Vector<AtomicString> Internals::userPreferredLanguages() const |
| { |
| return WebCore::userPreferredLanguages(); |
| } |
| +// Optimally, the bindings generator would pass a Vector<AtomicString> here but |
| +// this is not supported yet. |
| void Internals::setUserPreferredLanguages(const Vector<String>& languages) |
| { |
| - WebCore::overrideUserPreferredLanguages(languages); |
| + Vector<AtomicString> atomicLanguages; |
| + for (size_t i = 0; i < languages.size(); ++i) |
| + atomicLanguages.append(AtomicString(languages[i])); |
| + WebCore::overrideUserPreferredLanguages(atomicLanguages); |
| } |
| unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& exceptionState) |