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

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

Issue 1443663003: Implement the 'noopener' link relation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: browsertest Created 5 years, 1 month 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 * (C) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 return m_linkRelations & relation; 293 return m_linkRelations & relation;
294 } 294 }
295 295
296 void HTMLAnchorElement::setRel(const AtomicString& value) 296 void HTMLAnchorElement::setRel(const AtomicString& value)
297 { 297 {
298 m_linkRelations = 0; 298 m_linkRelations = 0;
299 SpaceSplitString newLinkRelations(value, SpaceSplitString::ShouldFoldCase); 299 SpaceSplitString newLinkRelations(value, SpaceSplitString::ShouldFoldCase);
300 // FIXME: Add link relations as they are implemented 300 // FIXME: Add link relations as they are implemented
301 if (newLinkRelations.contains("noreferrer")) 301 if (newLinkRelations.contains("noreferrer"))
302 m_linkRelations |= RelationNoReferrer; 302 m_linkRelations |= RelationNoReferrer;
303 if (newLinkRelations.contains("noopener"))
304 m_linkRelations |= RelationNoOpener;
303 } 305 }
304 306
305 const AtomicString& HTMLAnchorElement::name() const 307 const AtomicString& HTMLAnchorElement::name() const
306 { 308 {
307 return getNameAttribute(); 309 return getNameAttribute();
308 } 310 }
309 311
310 short HTMLAnchorElement::tabIndex() const 312 short HTMLAnchorElement::tabIndex() const
311 { 313 {
312 // Skip the supportsFocus check in HTMLElement. 314 // Skip the supportsFocus check in HTMLElement.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 366
365 frame->loader().client()->loadURLExternally(request, NavigationPolicyDow nload, suggestedName, false); 367 frame->loader().client()->loadURLExternally(request, NavigationPolicyDow nload, suggestedName, false);
366 } else { 368 } else {
367 request.setRequestContext(WebURLRequest::RequestContextHyperlink); 369 request.setRequestContext(WebURLRequest::RequestContextHyperlink);
368 FrameLoadRequest frameRequest(&document(), request, getAttribute(targetA ttr)); 370 FrameLoadRequest frameRequest(&document(), request, getAttribute(targetA ttr));
369 frameRequest.setTriggeringEvent(event); 371 frameRequest.setTriggeringEvent(event);
370 if (hasRel(RelationNoReferrer)) { 372 if (hasRel(RelationNoReferrer)) {
371 frameRequest.setShouldSendReferrer(NeverSendReferrer); 373 frameRequest.setShouldSendReferrer(NeverSendReferrer);
372 frameRequest.setShouldSetOpener(NeverSetOpener); 374 frameRequest.setShouldSetOpener(NeverSetOpener);
373 } 375 }
376 if (hasRel(RelationNoOpener))
377 frameRequest.setShouldSetOpener(NeverSetOpener);
374 frame->loader().load(frameRequest); 378 frame->loader().load(frameRequest);
375 } 379 }
376 } 380 }
377 381
378 bool isEnterKeyKeydownEvent(Event* event) 382 bool isEnterKeyKeydownEvent(Event* event)
379 { 383 {
380 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter"; 384 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
381 } 385 }
382 386
383 bool isLinkClick(Event* event) 387 bool isLinkClick(Event* event)
(...skipping 19 matching lines...) Expand all
403 Vector<String> argv; 407 Vector<String> argv;
404 argv.append("a"); 408 argv.append("a");
405 argv.append(fastGetAttribute(hrefAttr)); 409 argv.append(fastGetAttribute(hrefAttr));
406 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() ); 410 activityLogger->logEvent("blinkAddElement", argv.size(), argv.data() );
407 } 411 }
408 } 412 }
409 return HTMLElement::insertedInto(insertionPoint); 413 return HTMLElement::insertedInto(insertionPoint);
410 } 414 }
411 415
412 } // namespace blink 416 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698