OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 } | 750 } |
751 | 751 |
752 return String(); | 752 return String(); |
753 } | 753 } |
754 | 754 |
755 #if ENABLE(INPUT_TYPE_COLOR) | 755 #if ENABLE(INPUT_TYPE_COLOR) |
756 void Internals::selectColorInColorChooser(Element* element, const String& colorV
alue) | 756 void Internals::selectColorInColorChooser(Element* element, const String& colorV
alue) |
757 { | 757 { |
758 if (!element->hasTagName(inputTag)) | 758 if (!element->hasTagName(inputTag)) |
759 return; | 759 return; |
760 HTMLInputElement* inputElement = element->toInputElement(); | 760 Handle<HTMLInputElement> inputElement = element->toInputElement(); |
761 if (!inputElement) | 761 if (!inputElement) |
762 return; | 762 return; |
763 inputElement->selectColorInColorChooser(Color(colorValue)); | 763 inputElement->selectColorInColorChooser(Color(colorValue)); |
764 } | 764 } |
765 #endif | 765 #endif |
766 | 766 |
767 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& e
c) | 767 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionCode& e
c) |
768 { | 768 { |
769 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); | 769 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); |
770 if (!mainItem) { | 770 if (!mainItem) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 return "viewport size " + String::number(attributes.layoutSize.width()) + "x
" + String::number(attributes.layoutSize.height()) + " scale " + String::number(
attributes.initialScale) + " with limits [" + String::number(attributes.minimumS
cale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " +
(attributes.userScalable ? "true" : "false"); | 995 return "viewport size " + String::number(attributes.layoutSize.width()) + "x
" + String::number(attributes.layoutSize.height()) + " scale " + String::number(
attributes.initialScale) + " with limits [" + String::number(attributes.minimumS
cale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " +
(attributes.userScalable ? "true" : "false"); |
996 } | 996 } |
997 | 997 |
998 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) | 998 bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) |
999 { | 999 { |
1000 if (!textField) { | 1000 if (!textField) { |
1001 ec = INVALID_ACCESS_ERR; | 1001 ec = INVALID_ACCESS_ERR; |
1002 return false; | 1002 return false; |
1003 } | 1003 } |
1004 | 1004 |
1005 if (HTMLInputElement* inputElement = textField->toInputElement()) | 1005 if (Handle<HTMLInputElement> inputElement = textField->toInputElement()) |
1006 return inputElement->lastChangeWasUserEdit(); | 1006 return inputElement->lastChangeWasUserEdit(); |
1007 | 1007 |
1008 // FIXME: We should be using hasTagName instead but Windows port doesn't lin
k QualifiedNames properly. | 1008 // FIXME: We should be using hasTagName instead but Windows port doesn't lin
k QualifiedNames properly. |
1009 if (textField->tagName() == "TEXTAREA") | 1009 if (textField->tagName() == "TEXTAREA") |
1010 return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEd
it(); | 1010 return static_cast<HTMLTextAreaElement*>(textField)->lastChangeWasUserEd
it(); |
1011 | 1011 |
1012 ec = INVALID_NODE_TYPE_ERR; | 1012 ec = INVALID_NODE_TYPE_ERR; |
1013 return false; | 1013 return false; |
1014 } | 1014 } |
1015 | 1015 |
1016 bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec) | 1016 bool Internals::elementShouldAutoComplete(Element* element, ExceptionCode& ec) |
1017 { | 1017 { |
1018 if (!element) { | 1018 if (!element) { |
1019 ec = INVALID_ACCESS_ERR; | 1019 ec = INVALID_ACCESS_ERR; |
1020 return false; | 1020 return false; |
1021 } | 1021 } |
1022 | 1022 |
1023 if (HTMLInputElement* inputElement = element->toInputElement()) | 1023 if (Handle<HTMLInputElement> inputElement = element->toInputElement()) |
1024 return inputElement->shouldAutocomplete(); | 1024 return inputElement->shouldAutocomplete(); |
1025 | 1025 |
1026 ec = INVALID_NODE_TYPE_ERR; | 1026 ec = INVALID_NODE_TYPE_ERR; |
1027 return false; | 1027 return false; |
1028 } | 1028 } |
1029 | 1029 |
1030 String Internals::suggestedValue(Element* element, ExceptionCode& ec) | 1030 String Internals::suggestedValue(Element* element, ExceptionCode& ec) |
1031 { | 1031 { |
1032 if (!element) { | 1032 if (!element) { |
1033 ec = INVALID_ACCESS_ERR; | 1033 ec = INVALID_ACCESS_ERR; |
1034 return String(); | 1034 return String(); |
1035 } | 1035 } |
1036 | 1036 |
1037 HTMLInputElement* inputElement = element->toInputElement(); | 1037 Handle<HTMLInputElement> inputElement = element->toInputElement(); |
1038 if (!inputElement) { | 1038 if (!inputElement) { |
1039 ec = INVALID_NODE_TYPE_ERR; | 1039 ec = INVALID_NODE_TYPE_ERR; |
1040 return String(); | 1040 return String(); |
1041 } | 1041 } |
1042 | 1042 |
1043 return inputElement->suggestedValue(); | 1043 return inputElement->suggestedValue(); |
1044 } | 1044 } |
1045 | 1045 |
1046 void Internals::setSuggestedValue(Element* element, const String& value, Excepti
onCode& ec) | 1046 void Internals::setSuggestedValue(Element* element, const String& value, Excepti
onCode& ec) |
1047 { | 1047 { |
1048 if (!element) { | 1048 if (!element) { |
1049 ec = INVALID_ACCESS_ERR; | 1049 ec = INVALID_ACCESS_ERR; |
1050 return; | 1050 return; |
1051 } | 1051 } |
1052 | 1052 |
1053 HTMLInputElement* inputElement = element->toInputElement(); | 1053 Handle<HTMLInputElement> inputElement = element->toInputElement(); |
1054 if (!inputElement) { | 1054 if (!inputElement) { |
1055 ec = INVALID_NODE_TYPE_ERR; | 1055 ec = INVALID_NODE_TYPE_ERR; |
1056 return; | 1056 return; |
1057 } | 1057 } |
1058 | 1058 |
1059 inputElement->setSuggestedValue(value); | 1059 inputElement->setSuggestedValue(value); |
1060 } | 1060 } |
1061 | 1061 |
1062 void Internals::setEditingValue(Element* element, const String& value, Exception
Code& ec) | 1062 void Internals::setEditingValue(Element* element, const String& value, Exception
Code& ec) |
1063 { | 1063 { |
1064 if (!element) { | 1064 if (!element) { |
1065 ec = INVALID_ACCESS_ERR; | 1065 ec = INVALID_ACCESS_ERR; |
1066 return; | 1066 return; |
1067 } | 1067 } |
1068 | 1068 |
1069 HTMLInputElement* inputElement = element->toInputElement(); | 1069 Handle<HTMLInputElement> inputElement = element->toInputElement(); |
1070 if (!inputElement) { | 1070 if (!inputElement) { |
1071 ec = INVALID_NODE_TYPE_ERR; | 1071 ec = INVALID_NODE_TYPE_ERR; |
1072 return; | 1072 return; |
1073 } | 1073 } |
1074 | 1074 |
1075 inputElement->setEditingValue(value); | 1075 inputElement->setEditingValue(value); |
1076 } | 1076 } |
1077 | 1077 |
1078 void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec) | 1078 void Internals::setAutofilled(Element* element, bool enabled, ExceptionCode& ec) |
1079 { | 1079 { |
1080 HTMLInputElement* inputElement = element->toInputElement(); | 1080 Handle<HTMLInputElement> inputElement = element->toInputElement(); |
1081 if (!inputElement) { | 1081 if (!inputElement) { |
1082 ec = INVALID_ACCESS_ERR; | 1082 ec = INVALID_ACCESS_ERR; |
1083 return; | 1083 return; |
1084 } | 1084 } |
1085 inputElement->setAutofilled(enabled); | 1085 inputElement->setAutofilled(enabled); |
1086 } | 1086 } |
1087 | 1087 |
1088 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo
ng h, ExceptionCode& ec) | 1088 void Internals::scrollElementToRect(Element* element, long x, long y, long w, lo
ng h, ExceptionCode& ec) |
1089 { | 1089 { |
1090 if (!element || !element->document() || !element->document()->view()) { | 1090 if (!element || !element->document() || !element->document()->view()) { |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 return String(); | 1986 return String(); |
1987 } | 1987 } |
1988 return element->imageSourceURL(); | 1988 return element->imageSourceURL(); |
1989 } | 1989 } |
1990 | 1990 |
1991 bool Internals::isSelectPopupVisible(Node* node) | 1991 bool Internals::isSelectPopupVisible(Node* node) |
1992 { | 1992 { |
1993 if (!isHTMLSelectElement(node)) | 1993 if (!isHTMLSelectElement(node)) |
1994 return false; | 1994 return false; |
1995 | 1995 |
1996 HTMLSelectElement* select = toHTMLSelectElement(node); | 1996 Handle<HTMLSelectElement> select = toHTMLSelectElement(node); |
1997 | 1997 |
1998 RenderObject* renderer = select->renderer(); | 1998 RenderObject* renderer = select->renderer(); |
1999 if (!renderer->isMenuList()) | 1999 if (!renderer->isMenuList()) |
2000 return false; | 2000 return false; |
2001 | 2001 |
2002 RenderMenuList* menuList = toRenderMenuList(renderer); | 2002 RenderMenuList* menuList = toRenderMenuList(renderer); |
2003 return menuList->popupIsVisible(); | 2003 return menuList->popupIsVisible(); |
2004 } | 2004 } |
2005 | 2005 |
2006 } | 2006 } |
OLD | NEW |