OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Igalia S.L | 3 * Copyright (C) 2010 Igalia S.L |
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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void ContextMenuController::PopulateCustomContextMenu(const Event& event) { | 84 void ContextMenuController::PopulateCustomContextMenu(const Event& event) { |
85 if (!RuntimeEnabledFeatures::contextMenuEnabled()) | 85 if (!RuntimeEnabledFeatures::contextMenuEnabled()) |
86 return; | 86 return; |
87 | 87 |
88 Node* node = event.target()->ToNode(); | 88 Node* node = event.target()->ToNode(); |
89 if (!node || !node->IsHTMLElement()) | 89 if (!node || !node->IsHTMLElement()) |
90 return; | 90 return; |
91 | 91 |
92 HTMLElement& element = ToHTMLElement(*node); | 92 HTMLElement& element = ToHTMLElement(*node); |
93 HTMLMenuElement* menu_element = element.AssignedContextMenu(); | 93 HTMLMenuElement* menu_element = element.AssignedContextMenu(); |
94 if (!menu_element || | 94 if (!menu_element || !DeprecatedEqualIgnoringCase( |
95 !EqualIgnoringCase(menu_element->FastGetAttribute(typeAttr), "context")) | 95 menu_element->FastGetAttribute(typeAttr), "context")) |
96 return; | 96 return; |
97 RelatedEvent* related_event = | 97 RelatedEvent* related_event = |
98 RelatedEvent::Create(EventTypeNames::show, true, true, node); | 98 RelatedEvent::Create(EventTypeNames::show, true, true, node); |
99 if (menu_element->DispatchEvent(related_event) != | 99 if (menu_element->DispatchEvent(related_event) != |
100 DispatchEventResult::kNotCanceled) | 100 DispatchEventResult::kNotCanceled) |
101 return; | 101 return; |
102 if (menu_element != element.AssignedContextMenu()) | 102 if (menu_element != element.AssignedContextMenu()) |
103 return; | 103 return; |
104 menu_provider_ = CustomContextMenuProvider::Create(*menu_element, element); | 104 menu_provider_ = CustomContextMenuProvider::Create(*menu_element, element); |
105 menu_provider_->PopulateContextMenu(context_menu_.get()); | 105 menu_provider_->PopulateContextMenu(context_menu_.get()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 if (item->Action() < kContextMenuItemBaseCustomTag || | 180 if (item->Action() < kContextMenuItemBaseCustomTag || |
181 item->Action() > kContextMenuItemLastCustomTag) | 181 item->Action() > kContextMenuItemLastCustomTag) |
182 return; | 182 return; |
183 | 183 |
184 ASSERT(menu_provider_); | 184 ASSERT(menu_provider_); |
185 menu_provider_->ContextMenuItemSelected(item); | 185 menu_provider_->ContextMenuItemSelected(item); |
186 } | 186 } |
187 | 187 |
188 } // namespace blink | 188 } // namespace blink |
OLD | NEW |