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

Side by Side Diff: sky/engine/core/html/HTMLAnchorElement.cpp

Issue 695803003: Make clicks on <a> request a navigation (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 21 matching lines...) Expand all
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/frame/Settings.h" 33 #include "core/frame/Settings.h"
34 #include "core/frame/UseCounter.h" 34 #include "core/frame/UseCounter.h"
35 #include "core/html/HTMLImageElement.h" 35 #include "core/html/HTMLImageElement.h"
36 #include "core/html/parser/HTMLParserIdioms.h" 36 #include "core/html/parser/HTMLParserIdioms.h"
37 #include "core/loader/FrameLoaderClient.h" 37 #include "core/loader/FrameLoaderClient.h"
38 #include "core/loader/FrameLoaderTypes.h" 38 #include "core/loader/FrameLoaderTypes.h"
39 #include "core/page/Chrome.h" 39 #include "core/page/Chrome.h"
40 #include "core/page/ChromeClient.h" 40 #include "core/page/ChromeClient.h"
41 #include "core/rendering/RenderImage.h" 41 #include "core/rendering/RenderImage.h"
42 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
42 #include "platform/PlatformMouseEvent.h" 43 #include "platform/PlatformMouseEvent.h"
43 #include "platform/network/ResourceRequest.h" 44 #include "platform/network/ResourceRequest.h"
44 #include "platform/weborigin/KnownPorts.h" 45 #include "platform/weborigin/KnownPorts.h"
45 #include "platform/weborigin/SecurityPolicy.h" 46 #include "platform/weborigin/SecurityPolicy.h"
46 #include "public/platform/Platform.h" 47 #include "public/platform/Platform.h"
48 #include "public/platform/ServiceProvider.h"
47 #include "public/platform/WebURL.h" 49 #include "public/platform/WebURL.h"
48 #include "public/platform/WebURLRequest.h" 50 #include "public/platform/WebURLRequest.h"
49 #include "wtf/text/StringBuilder.h" 51 #include "wtf/text/StringBuilder.h"
50 52
51 namespace blink { 53 namespace blink {
52 54
53 static bool isEnterKeyKeydownEvent(Event* event) 55 static bool isEnterKeyKeydownEvent(Event* event)
54 { 56 {
55 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter"; 57 return event->type() == EventTypeNames::keydown && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter";
56 } 58 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 setAttribute(HTMLNames::hrefAttr, value); 123 setAttribute(HTMLNames::hrefAttr, value);
122 } 124 }
123 125
124 bool HTMLAnchorElement::isLiveLink() const 126 bool HTMLAnchorElement::isLiveLink() const
125 { 127 {
126 return !hasEditableStyle(); 128 return !hasEditableStyle();
127 } 129 }
128 130
129 void HTMLAnchorElement::handleClick(Event* event) 131 void HTMLAnchorElement::handleClick(Event* event)
130 { 132 {
133 Frame* frame = document().frame();
134 if (!frame)
135 return;
136 FrameHost* host = frame->host();
137 if (!host)
138 return;
139 mojo::URLRequestPtr request = mojo::URLRequest::New();
140 request->url = href().string().toUTF8();
141 host->services().NavigatorHost()->RequestNavigate(
142 mojo::TARGET_SOURCE_NODE, request.Pass());
131 event->setDefaultHandled(); 143 event->setDefaultHandled();
132 // FIXME(sky): reimplement
133 } 144 }
134 145
135 bool HTMLAnchorElement::willRespondToMouseClickEvents() 146 bool HTMLAnchorElement::willRespondToMouseClickEvents()
136 { 147 {
137 return isLiveLink(); 148 return isLiveLink();
138 } 149 }
139 150
140 bool HTMLAnchorElement::isInteractiveContent() const 151 bool HTMLAnchorElement::isInteractiveContent() const
141 { 152 {
142 return isLiveLink(); 153 return isLiveLink();
143 } 154 }
144 155
145 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698