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

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

Issue 2507023002: Support script modify iframe scrolling, marginWidth and marginHeight attr (Closed)
Patch Set: add null check Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
index eb81d639c4de017fbb4adf4c46265078a85c0f43..3e0a3fc1acc79cd411d5799f18b0134086adcddf 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
@@ -38,6 +38,7 @@
#include "core/loader/FrameLoaderClient.h"
#include "core/page/FocusController.h"
#include "core/page/Page.h"
+#include "wtf/Optional.h"
namespace blink {
@@ -117,8 +118,9 @@ void HTMLFrameElementBase::openURL(bool replaceCurrentItem) {
void HTMLFrameElementBase::frameOwnerPropertiesChanged() {
// Don't notify about updates if contentFrame() is null, for example when
// the subframe hasn't been created yet.
- if (contentFrame())
+ if (contentFrame()) {
document().frame()->loader().client()->didChangeFrameOwnerProperties(this);
+ }
}
void HTMLFrameElementBase::parseAttribute(const QualifiedName& name,
@@ -141,16 +143,10 @@ void HTMLFrameElementBase::parseAttribute(const QualifiedName& name,
m_frameName = value;
} else if (name == nameAttr) {
m_frameName = value;
- // FIXME: If we are already attached, this doesn't actually change the
- // frame's name.
- // FIXME: If we are already attached, this doesn't check for frame name
- // conflicts and generate a unique frame name.
} else if (name == marginwidthAttr) {
setMarginWidth(value.toInt());
- // FIXME: If we are already attached, this has no effect.
} else if (name == marginheightAttr) {
setMarginHeight(value.toInt());
- // FIXME: If we are already attached, this has no effect.
} else if (name == scrollingAttr) {
// Auto and yes both simply mean "allow scrolling." No means "don't allow
// scrolling."
@@ -158,7 +154,6 @@ void HTMLFrameElementBase::parseAttribute(const QualifiedName& name,
setScrollingMode(ScrollbarAuto);
else if (equalIgnoringCase(value, "no"))
setScrollingMode(ScrollbarAlwaysOff);
- // FIXME: If we are already attached, this has no effect.
} else if (name == onbeforeunloadAttr) {
// FIXME: should <frame> elements have beforeunload handlers?
setAttributeEventListener(
@@ -253,17 +248,38 @@ void HTMLFrameElementBase::defaultEventHandler(Event* event) {
}
void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) {
+ if (m_scrollingMode == scrollbarMode)
+ return;
+
m_scrollingMode = scrollbarMode;
+ if (contentDocument()) {
+ contentDocument()->didChangeFrameOwnerProperties(WTF::nullopt, WTF::nullopt,
+ true);
+ }
frameOwnerPropertiesChanged();
}
void HTMLFrameElementBase::setMarginWidth(int marginWidth) {
+ if (m_marginWidth == marginWidth)
+ return;
+
m_marginWidth = marginWidth;
+ if (contentDocument()) {
+ contentDocument()->didChangeFrameOwnerProperties(marginWidth, WTF::nullopt,
+ false);
+ }
frameOwnerPropertiesChanged();
}
void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
+ if (m_marginHeight == marginHeight)
+ return;
+
m_marginHeight = marginHeight;
+ if (contentDocument()) {
+ contentDocument()->didChangeFrameOwnerProperties(WTF::nullopt, marginHeight,
+ false);
+ }
frameOwnerPropertiesChanged();
}

Powered by Google App Engine
This is Rietveld 408576698