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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameletElement.cpp

Issue 1602663003: Framelet Prototype 2016 using Mojo IPC Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Disabled oilpan Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLFrameletElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameletElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameletElement.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9cd5ccc704b457b70dccc72ff9f7592d01670086
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/HTMLFrameletElement.cpp
@@ -0,0 +1,145 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/html/HTMLFrameletElement.h"
+
+#include "core/CSSPropertyNames.h"
+#include "core/HTMLNames.h"
+#include "core/frame/Framelet.h"
+#include "core/html/HTMLDocument.h"
+#include "core/html/parser/HTMLParserIdioms.h"
+#include "core/layout/LayoutFramelet.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "platform/graphics/GraphicsLayer.h"
+
+namespace blink {
+
+using namespace HTMLNames;
+
+inline HTMLFrameletElement::HTMLFrameletElement(Document& document)
+ : HTMLFrameOwnerElement(frameletTag, document)
+ , m_webLayer(nullptr)
+ , m_framelet(nullptr)
+{
+}
+
+DEFINE_NODE_FACTORY(HTMLFrameletElement)
+
+HTMLFrameletElement::~HTMLFrameletElement()
+{
+}
+
+void HTMLFrameletElement::setURL(const String& str)
+{
+ if (framelet())
+ return;
+
+ m_URL = document().completeURL(str);
+
+ if (!m_URL.isEmpty() && inDocument())
+ document().frame()->loader().client()->createFramelet(m_URL, this);
+}
+
+void HTMLFrameletElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
+{
+ if (name == widthAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyWidth, value);
+ } else if (name == heightAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyHeight, value);
+ } else if (name == alignAttr) {
+ applyAlignmentAttributeToStyle(value, style);
+ } else if (name == frameborderAttr) {
+ // LocalFrame border doesn't really match the HTML4 spec definition for iframes. It simply adds
+ // a presentational hint that the border should be off if set to zero.
+ if (!value.toInt()) {
+ // Add a rule that nulls out our border width.
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSPrimitiveValue::UnitType::Pixels);
+ }
+ } else {
+ HTMLElement::collectStyleForPresentationAttribute(name, value, style);
+ }
+}
+
+void HTMLFrameletElement::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value)
+{
+ if (name == srcAttr) {
+ setURL(stripLeadingAndTrailingHTMLSpaces(value));
+ } else {
+ HTMLElement::parseAttribute(name, oldValue, value);
+ }
+}
+
+bool HTMLFrameletElement::layoutObjectIsNeeded(const ComputedStyle& style)
+{
+ return HTMLElement::layoutObjectIsNeeded(style);
+}
+
+LayoutObject* HTMLFrameletElement::createLayoutObject(const ComputedStyle&)
+{
+ return new LayoutFramelet(this);
+}
+
+Node::InsertionNotificationRequest HTMLFrameletElement::insertedInto(ContainerNode* insertionPoint)
+{
+ HTMLElement::insertedInto(insertionPoint);
+ return InsertionShouldCallDidNotifySubtreeInsertions;
+}
+
+void HTMLFrameletElement::didNotifySubtreeInsertionsToDocument()
+{
+ setURL(stripLeadingAndTrailingHTMLSpaces(fastGetAttribute(srcAttr)));
+}
+
+void HTMLFrameletElement::setWebLayer(WebLayer* webLayer)
+{
+ if (m_webLayer)
+ GraphicsLayer::unregisterContentsLayer(m_webLayer);
+ m_webLayer = webLayer;
+ if (m_webLayer)
+ GraphicsLayer::registerContentsLayer(m_webLayer);
+
+ setNeedsCompositingUpdate();
+}
+
+void HTMLFrameletElement::setFramelet(Framelet* framelet)
+{
+ m_framelet = framelet;
+}
+
+void HTMLFrameletElement::attach(const AttachContext& context)
+{
+ if (framelet())
+ framelet()->didAttach();
+ HTMLFrameOwnerElement::attach(context);
+}
+
+// FIXME: Remove this code once we have input routing in the browser
+// process. See http://crbug.com/339659.
+void HTMLFrameletElement::defaultEventHandler(Event* event)
+{
+ // We don't have a framelet object until initial navigation.
+ if (framelet())
+ framelet()->forwardInputEvent(event);
+ HTMLFrameOwnerElement::defaultEventHandler(event);
+}
+
+void HTMLFrameletElement::detach(const AttachContext& context)
+{
+ if (framelet())
+ framelet()->didDetach();
+ setWidget(nullptr);
+ HTMLFrameOwnerElement::detach(context);
+}
+
+
+bool HTMLFrameletElement::isKeyboardFocusable() const
+{
+ return true;
+}
+
+bool HTMLFrameletElement::supportsFocus() const
+{
+ return true;
+}
+}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFrameletElement.h ('k') | third_party/WebKit/Source/core/html/HTMLFrameletElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698