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

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 fix for marginWidth and marginHeight 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..c31d903c50ad77a4ac2f093edb4a897330fecd8c 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
@@ -117,8 +117,16 @@ 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);
+ if (contentFrame()->isLocalFrame()) {
+ contentDocument()->body()->setIntegralAttribute(marginwidthAttr,
bokan 2016/11/18 20:56:18 These should be done inside setMarginWidth/setMarg
+ m_marginWidth);
+ contentDocument()->body()->setIntegralAttribute(marginheightAttr,
+ m_marginHeight);
+ toLocalFrame(contentFrame())->view()->setNeedsLayout();
+ }
+ }
}
void HTMLFrameElementBase::parseAttribute(const QualifiedName& name,
@@ -147,10 +155,8 @@ void HTMLFrameElementBase::parseAttribute(const QualifiedName& 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 +164,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.
bokan 2016/11/18 20:56:18 What did these FIXMEs mean?
chaopeng 2016/11/18 21:25:03 I think it means these 3 attributes doesnot suppor
bokan 2016/11/18 21:37:03 Hmm, I think it was to mean that calling this func
} else if (name == onbeforeunloadAttr) {
// FIXME: should <frame> elements have beforeunload handlers?
setAttributeEventListener(
@@ -253,16 +258,25 @@ void HTMLFrameElementBase::defaultEventHandler(Event* event) {
}
void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) {
+ if (m_scrollingMode == scrollbarMode)
+ return;
+
m_scrollingMode = scrollbarMode;
frameOwnerPropertiesChanged();
}
void HTMLFrameElementBase::setMarginWidth(int marginWidth) {
+ if (m_marginWidth == marginWidth)
+ return;
+
m_marginWidth = marginWidth;
frameOwnerPropertiesChanged();
}
void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
+ if (m_marginHeight == marginHeight)
+ return;
+
m_marginHeight = marginHeight;
frameOwnerPropertiesChanged();
}

Powered by Google App Engine
This is Rietveld 408576698