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

Unified Diff: third_party/WebKit/Source/web/WebFrame.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/web/WebFrame.cpp
diff --git a/third_party/WebKit/Source/web/WebFrame.cpp b/third_party/WebKit/Source/web/WebFrame.cpp
index 79ce1ac6b9979b00595c6cfcf32f373238e62f1c..cae52bf06f0a9f88c6c231ba64ce45f5c67d8ae6 100644
--- a/third_party/WebKit/Source/web/WebFrame.cpp
+++ b/third_party/WebKit/Source/web/WebFrame.cpp
@@ -5,6 +5,7 @@
#include "public/web/WebFrame.h"
#include "bindings/core/v8/WindowProxyManager.h"
+#include "core/HTMLNames.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
@@ -21,10 +22,13 @@
#include "web/RemoteFrameOwner.h"
#include "web/WebLocalFrameImpl.h"
#include "web/WebRemoteFrameImpl.h"
+#include "wtf/Optional.h"
#include <algorithm>
namespace blink {
+using namespace HTMLNames;
+
bool WebFrame::swap(WebFrame* frame) {
using std::swap;
Frame* oldFrame = toImplBase()->frame();
@@ -138,12 +142,38 @@ void WebFrame::setFrameOwnerProperties(
// for frames with a remote owner.
RemoteFrameOwner* owner = toRemoteFrameOwner(toImplBase()->frame()->owner());
DCHECK(owner);
- owner->setScrollingMode(properties.scrollingMode);
- owner->setMarginWidth(properties.marginWidth);
- owner->setMarginHeight(properties.marginHeight);
+
+ Optional<int> marginWidth;
+ Optional<int> marginHeight;
+ bool scrollingModeChanged = false;
+
+ if (owner->scrollingMode() !=
+ static_cast<ScrollbarMode>(properties.scrollingMode)) {
+ owner->setScrollingMode(properties.scrollingMode);
bokan 2016/11/21 13:21:52 There's no need to check for changes when setting
+ scrollingModeChanged = true;
+ }
+ if (owner->marginWidth() != properties.marginWidth) {
+ owner->setMarginWidth(properties.marginWidth);
+ marginWidth = properties.marginWidth;
+ }
+ if (owner->marginHeight() != properties.marginHeight) {
+ owner->setMarginHeight(properties.marginHeight);
+ marginHeight = properties.marginHeight;
+ }
owner->setAllowFullscreen(properties.allowFullscreen);
owner->setCsp(properties.requiredCsp);
owner->setDelegatedpermissions(properties.delegatedPermissions);
+
+ Frame* frame = toImplBase()->frame();
+ DCHECK(frame);
+
+ if (frame->isLocalFrame()) {
+ LocalFrame* localFrame = toLocalFrame(frame);
+ if (localFrame->document()) {
+ localFrame->document()->didChangeFrameOwnerProperties(
bokan 2016/11/21 13:21:52 If you move this up to before we set the values on
+ marginWidth, marginHeight, scrollingModeChanged);
+ }
+ }
}
WebFrame* WebFrame::opener() const {

Powered by Google App Engine
This is Rietveld 408576698