Index: Source/core/page/CustomContextMenuProvider.cpp |
diff --git a/Source/core/page/CustomContextMenuProvider.cpp b/Source/core/page/CustomContextMenuProvider.cpp |
index d60fe9ebc9fc5b7b378263303cf794968c2c1629..1fbb11efb639a887105867fcbeeea01f1df5ea37 100644 |
--- a/Source/core/page/CustomContextMenuProvider.cpp |
+++ b/Source/core/page/CustomContextMenuProvider.cpp |
@@ -69,7 +69,7 @@ void CustomContextMenuProvider::appendSeparator(ContextMenu& contextMenu) |
if (lastItem.type() == SeparatorType) |
return; |
- contextMenu.appendItem(ContextMenuItem(SeparatorType, ContextMenuItemCustomTagNoAction, String())); |
+ contextMenu.appendItem(ContextMenuItem(SeparatorType, ContextMenuItemCustomTagNoAction, String(), String())); |
} |
void CustomContextMenuProvider::appendMenuItem(HTMLMenuItemElement* menuItem, ContextMenu& contextMenu) |
@@ -82,11 +82,18 @@ void CustomContextMenuProvider::appendMenuItem(HTMLMenuItemElement* menuItem, Co |
m_menuItems.append(menuItem); |
bool enabled = !menuItem->fastHasAttribute(disabledAttr); |
+ String icon = menuItem->fastGetAttribute(iconAttr); |
+ if (!icon.isEmpty()) { |
+ // To obtain the absolute URL of the icon when the attribute's value is not the empty string, |
+ // the attribute's value must be resolved relative to the element. |
+ KURL iconURL = KURL(menuItem->baseURI(), icon); |
+ icon = iconURL.string(); |
+ } |
ContextMenuAction action = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + m_menuItems.size() - 1); |
if (equalIgnoringCase(menuItem->fastGetAttribute(typeAttr), "checkbox") || equalIgnoringCase(menuItem->fastGetAttribute(typeAttr), "radio")) |
- contextMenu.appendItem(ContextMenuItem(CheckableActionType, action, labelString, enabled, menuItem->fastHasAttribute(checkedAttr))); |
+ contextMenu.appendItem(ContextMenuItem(CheckableActionType, action, labelString, icon, enabled, menuItem->fastHasAttribute(checkedAttr))); |
else |
- contextMenu.appendItem(ContextMenuItem(ActionType, action, labelString, enabled, false)); |
+ contextMenu.appendItem(ContextMenuItem(ActionType, action, labelString, icon, enabled, false)); |
} |
void CustomContextMenuProvider::populateContextMenuItems(const HTMLMenuElement& menu, ContextMenu& contextMenu) |
@@ -105,7 +112,7 @@ void CustomContextMenuProvider::populateContextMenuItems(const HTMLMenuElement& |
appendSeparator(contextMenu); |
} else if (!labelString.isEmpty()) { |
populateContextMenuItems(*toHTMLMenuElement(nextElement), subMenu); |
- contextMenu.appendItem(ContextMenuItem(SubmenuType, ContextMenuItemCustomTagNoAction, labelString, &subMenu)); |
+ contextMenu.appendItem(ContextMenuItem(SubmenuType, ContextMenuItemCustomTagNoAction, labelString, String(), &subMenu)); |
} |
nextElement = Traversal<HTMLElement>::nextSibling(*nextElement); |
} else if (isHTMLMenuItemElement(*nextElement)) { |