| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "core/editing/spellcheck/SpellChecker.h" | 50 #include "core/editing/spellcheck/SpellChecker.h" |
| 51 #include "core/events/EventListener.h" | 51 #include "core/events/EventListener.h" |
| 52 #include "core/events/KeyboardEvent.h" | 52 #include "core/events/KeyboardEvent.h" |
| 53 #include "core/frame/Settings.h" | 53 #include "core/frame/Settings.h" |
| 54 #include "core/frame/UseCounter.h" | 54 #include "core/frame/UseCounter.h" |
| 55 #include "core/frame/csp/ContentSecurityPolicy.h" | 55 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 56 #include "core/html/HTMLBRElement.h" | 56 #include "core/html/HTMLBRElement.h" |
| 57 #include "core/html/HTMLDimension.h" | 57 #include "core/html/HTMLDimension.h" |
| 58 #include "core/html/HTMLFormElement.h" | 58 #include "core/html/HTMLFormElement.h" |
| 59 #include "core/html/HTMLInputElement.h" | 59 #include "core/html/HTMLInputElement.h" |
| 60 #include "core/html/HTMLMenuElement.h" | |
| 61 #include "core/html/HTMLTemplateElement.h" | 60 #include "core/html/HTMLTemplateElement.h" |
| 62 #include "core/html/parser/HTMLParserIdioms.h" | 61 #include "core/html/parser/HTMLParserIdioms.h" |
| 63 #include "core/layout/LayoutBoxModelObject.h" | 62 #include "core/layout/LayoutBoxModelObject.h" |
| 64 #include "core/layout/LayoutObject.h" | 63 #include "core/layout/LayoutObject.h" |
| 65 #include "core/page/SpatialNavigation.h" | 64 #include "core/page/SpatialNavigation.h" |
| 66 #include "core/svg/SVGSVGElement.h" | 65 #include "core/svg/SVGSVGElement.h" |
| 67 #include "platform/Language.h" | 66 #include "platform/Language.h" |
| 68 #include "platform/text/BidiResolver.h" | 67 #include "platform/text/BidiResolver.h" |
| 69 #include "platform/text/BidiTextRun.h" | 68 #include "platform/text/BidiTextRun.h" |
| 70 #include "platform/text/TextRunIterator.h" | 69 #include "platform/text/TextRunIterator.h" |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 if (!ParseColorWithLegacyRules(attribute_value, parsed_color)) | 1059 if (!ParseColorWithLegacyRules(attribute_value, parsed_color)) |
| 1061 return; | 1060 return; |
| 1062 | 1061 |
| 1063 style->SetProperty(property_id, *CSSColorValue::Create(parsed_color.Rgb())); | 1062 style->SetProperty(property_id, *CSSColorValue::Create(parsed_color.Rgb())); |
| 1064 } | 1063 } |
| 1065 | 1064 |
| 1066 bool HTMLElement::IsInteractiveContent() const { | 1065 bool HTMLElement::IsInteractiveContent() const { |
| 1067 return false; | 1066 return false; |
| 1068 } | 1067 } |
| 1069 | 1068 |
| 1070 HTMLMenuElement* HTMLElement::AssignedContextMenu() const { | |
| 1071 if (HTMLMenuElement* menu = contextMenu()) | |
| 1072 return menu; | |
| 1073 | |
| 1074 return parentElement() && parentElement()->IsHTMLElement() | |
| 1075 ? ToHTMLElement(parentElement())->AssignedContextMenu() | |
| 1076 : nullptr; | |
| 1077 } | |
| 1078 | |
| 1079 HTMLMenuElement* HTMLElement::contextMenu() const { | |
| 1080 const AtomicString& context_menu_id(FastGetAttribute(contextmenuAttr)); | |
| 1081 if (context_menu_id.IsNull()) | |
| 1082 return nullptr; | |
| 1083 | |
| 1084 Element* element = GetTreeScope().getElementById(context_menu_id); | |
| 1085 // Not checking if the menu element is of type "popup". | |
| 1086 // Ignoring menu element type attribute is intentional according to the | |
| 1087 // standard. | |
| 1088 return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : nullptr; | |
| 1089 } | |
| 1090 | |
| 1091 void HTMLElement::setContextMenu(HTMLMenuElement* context_menu) { | |
| 1092 if (!context_menu) { | |
| 1093 setAttribute(contextmenuAttr, ""); | |
| 1094 return; | |
| 1095 } | |
| 1096 | |
| 1097 // http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.
html#reflecting-content-attributes-in-idl-attributes | |
| 1098 // On setting, if the given element has an id attribute, and has the same home | |
| 1099 // subtree as the element of the attribute being set, and the given element is | |
| 1100 // the first element in that home subtree whose ID is the value of that id | |
| 1101 // attribute, then the content attribute must be set to the value of that id | |
| 1102 // attribute. Otherwise, the content attribute must be set to the empty | |
| 1103 // string. | |
| 1104 const AtomicString& context_menu_id(context_menu->FastGetAttribute(idAttr)); | |
| 1105 | |
| 1106 if (!context_menu_id.IsNull() && | |
| 1107 context_menu == GetTreeScope().getElementById(context_menu_id)) | |
| 1108 setAttribute(contextmenuAttr, context_menu_id); | |
| 1109 else | |
| 1110 setAttribute(contextmenuAttr, ""); | |
| 1111 } | |
| 1112 | |
| 1113 void HTMLElement::DefaultEventHandler(Event* event) { | 1069 void HTMLElement::DefaultEventHandler(Event* event) { |
| 1114 if (event->type() == EventTypeNames::keypress && event->IsKeyboardEvent()) { | 1070 if (event->type() == EventTypeNames::keypress && event->IsKeyboardEvent()) { |
| 1115 HandleKeypressEvent(ToKeyboardEvent(event)); | 1071 HandleKeypressEvent(ToKeyboardEvent(event)); |
| 1116 if (event->DefaultHandled()) | 1072 if (event->DefaultHandled()) |
| 1117 return; | 1073 return; |
| 1118 } | 1074 } |
| 1119 | 1075 |
| 1120 Element::DefaultEventHandler(event); | 1076 Element::DefaultEventHandler(event); |
| 1121 } | 1077 } |
| 1122 | 1078 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 | 1178 |
| 1223 #ifndef NDEBUG | 1179 #ifndef NDEBUG |
| 1224 | 1180 |
| 1225 // For use in the debugger | 1181 // For use in the debugger |
| 1226 void dumpInnerHTML(blink::HTMLElement*); | 1182 void dumpInnerHTML(blink::HTMLElement*); |
| 1227 | 1183 |
| 1228 void dumpInnerHTML(blink::HTMLElement* element) { | 1184 void dumpInnerHTML(blink::HTMLElement* element) { |
| 1229 printf("%s\n", element->innerHTML().Ascii().data()); | 1185 printf("%s\n", element->innerHTML().Ascii().data()); |
| 1230 } | 1186 } |
| 1231 #endif | 1187 #endif |
| OLD | NEW |