Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLElement.cpp

Issue 1885453002: Rename Node::treeScope() to Node::treeScopeOrDocument() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 return parentElement() && parentElement()->isHTMLElement() ? toHTMLElement(p arentElement())->assignedContextMenu() : nullptr; 948 return parentElement() && parentElement()->isHTMLElement() ? toHTMLElement(p arentElement())->assignedContextMenu() : nullptr;
949 } 949 }
950 950
951 HTMLMenuElement* HTMLElement::contextMenu() const 951 HTMLMenuElement* HTMLElement::contextMenu() const
952 { 952 {
953 const AtomicString& contextMenuId(fastGetAttribute(contextmenuAttr)); 953 const AtomicString& contextMenuId(fastGetAttribute(contextmenuAttr));
954 if (contextMenuId.isNull()) 954 if (contextMenuId.isNull())
955 return nullptr; 955 return nullptr;
956 956
957 Element* element = treeScope().getElementById(contextMenuId); 957 Element* element = treeScopeOrDocument().getElementById(contextMenuId);
958 // Not checking if the menu element is of type "popup". 958 // Not checking if the menu element is of type "popup".
959 // Ignoring menu element type attribute is intentional according to the stan dard. 959 // Ignoring menu element type attribute is intentional according to the stan dard.
960 return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : nullptr; 960 return isHTMLMenuElement(element) ? toHTMLMenuElement(element) : nullptr;
961 } 961 }
962 962
963 void HTMLElement::setContextMenu(HTMLMenuElement* contextMenu) 963 void HTMLElement::setContextMenu(HTMLMenuElement* contextMenu)
964 { 964 {
965 if (!contextMenu) { 965 if (!contextMenu) {
966 setAttribute(contextmenuAttr, ""); 966 setAttribute(contextmenuAttr, "");
967 return; 967 return;
968 } 968 }
969 969
970 // http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructur e.html#reflecting-content-attributes-in-idl-attributes 970 // http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructur e.html#reflecting-content-attributes-in-idl-attributes
971 // On setting, if the given element has an id attribute, and has the same ho me 971 // On setting, if the given element has an id attribute, and has the same ho me
972 // subtree as the element of the attribute being set, and the given element is the 972 // subtree as the element of the attribute being set, and the given element is the
973 // first element in that home subtree whose ID is the value of that id attri bute, 973 // first element in that home subtree whose ID is the value of that id attri bute,
974 // then the content attribute must be set to the value of that id attribute. 974 // then the content attribute must be set to the value of that id attribute.
975 // Otherwise, the content attribute must be set to the empty string. 975 // Otherwise, the content attribute must be set to the empty string.
976 const AtomicString& contextMenuId(contextMenu->fastGetAttribute(idAttr)); 976 const AtomicString& contextMenuId(contextMenu->fastGetAttribute(idAttr));
977 977
978 if (!contextMenuId.isNull() && contextMenu == treeScope().getElementById(con textMenuId)) 978 if (!contextMenuId.isNull() && contextMenu == treeScopeOrDocument().getEleme ntById(contextMenuId))
979 setAttribute(contextmenuAttr, contextMenuId); 979 setAttribute(contextmenuAttr, contextMenuId);
980 else 980 else
981 setAttribute(contextmenuAttr, ""); 981 setAttribute(contextmenuAttr, "");
982 } 982 }
983 983
984 void HTMLElement::defaultEventHandler(Event* event) 984 void HTMLElement::defaultEventHandler(Event* event)
985 { 985 {
986 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) { 986 if (event->type() == EventTypeNames::keypress && event->isKeyboardEvent()) {
987 handleKeypressEvent(toKeyboardEvent(event)); 987 handleKeypressEvent(toKeyboardEvent(event));
988 if (event->defaultHandled()) 988 if (event->defaultHandled())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 #ifndef NDEBUG 1039 #ifndef NDEBUG
1040 1040
1041 // For use in the debugger 1041 // For use in the debugger
1042 void dumpInnerHTML(blink::HTMLElement*); 1042 void dumpInnerHTML(blink::HTMLElement*);
1043 1043
1044 void dumpInnerHTML(blink::HTMLElement* element) 1044 void dumpInnerHTML(blink::HTMLElement* element)
1045 { 1045 {
1046 printf("%s\n", element->innerHTML().ascii().data()); 1046 printf("%s\n", element->innerHTML().ascii().data());
1047 } 1047 }
1048 #endif 1048 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698