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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 1031543003: Remove inheritance of designMode attribute. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments, add usage counter, rebase tests, rebase to ToT Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 , m_ignoreDestructiveWriteCount(0) 436 , m_ignoreDestructiveWriteCount(0)
437 , m_markers(adoptPtrWillBeNoop(new DocumentMarkerController)) 437 , m_markers(adoptPtrWillBeNoop(new DocumentMarkerController))
438 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red) 438 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red)
439 , m_cssTarget(nullptr) 439 , m_cssTarget(nullptr)
440 , m_loadEventProgress(LoadEventNotRun) 440 , m_loadEventProgress(LoadEventNotRun)
441 , m_startTime(currentTime()) 441 , m_startTime(currentTime())
442 , m_scriptRunner(ScriptRunner::create(this)) 442 , m_scriptRunner(ScriptRunner::create(this))
443 , m_xmlVersion("1.0") 443 , m_xmlVersion("1.0")
444 , m_xmlStandalone(StandaloneUnspecified) 444 , m_xmlStandalone(StandaloneUnspecified)
445 , m_hasXMLDeclaration(0) 445 , m_hasXMLDeclaration(0)
446 , m_designMode(inherit) 446 , m_designMode(false)
447 , m_hasAnnotatedRegions(false) 447 , m_hasAnnotatedRegions(false)
448 , m_annotatedRegionsDirty(false) 448 , m_annotatedRegionsDirty(false)
449 , m_useSecureKeyboardEntryWhenActive(false) 449 , m_useSecureKeyboardEntryWhenActive(false)
450 , m_documentClasses(documentClasses) 450 , m_documentClasses(documentClasses)
451 , m_isViewSource(false) 451 , m_isViewSource(false)
452 , m_sawElementsInKnownNamespaces(false) 452 , m_sawElementsInKnownNamespaces(false)
453 , m_isSrcdocDocument(false) 453 , m_isSrcdocDocument(false)
454 , m_isMobileDocument(false) 454 , m_isMobileDocument(false)
455 , m_isTransitionDocument(false) 455 , m_isTransitionDocument(false)
456 , m_layoutView(0) 456 , m_layoutView(0)
(...skipping 3860 matching lines...) Expand 10 before | Expand all | Expand 10 after
4317 { 4317 {
4318 ASSERT(!m_currentScriptStack.isEmpty()); 4318 ASSERT(!m_currentScriptStack.isEmpty());
4319 m_currentScriptStack.removeLast(); 4319 m_currentScriptStack.removeLast();
4320 } 4320 }
4321 4321
4322 void Document::setTransformSource(PassOwnPtr<TransformSource> source) 4322 void Document::setTransformSource(PassOwnPtr<TransformSource> source)
4323 { 4323 {
4324 m_transformSource = source; 4324 m_transformSource = source;
4325 } 4325 }
4326 4326
4327 void Document::setDesignMode(InheritedBool value)
4328 {
4329 m_designMode = value;
4330 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) {
4331 if (!frame->isLocalFrame())
4332 continue;
4333 if (!toLocalFrame(frame)->document())
4334 break;
4335 toLocalFrame(frame)->document()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::DesignMode));
4336 }
4337 }
4338
4339 bool Document::inDesignMode() const
4340 {
4341 for (const Document* d = this; d; d = d->parentDocument()) {
4342 if (d->m_designMode != inherit)
4343 return d->m_designMode;
4344 }
4345 return false;
4346 }
4347
4348 String Document::designMode() const 4327 String Document::designMode() const
4349 { 4328 {
4350 return inDesignMode() ? "on" : "off"; 4329 return inDesignMode() ? "on" : "off";
4351 } 4330 }
4352 4331
4353 void Document::setDesignMode(const String& value) 4332 void Document::setDesignMode(const String& value)
4354 { 4333 {
4355 InheritedBool mode; 4334 bool newValue = m_designMode;
4356 if (equalIgnoringCase(value, "on")) 4335 if (equalIgnoringCase(value, "on"))
4357 mode = on; 4336 newValue = true;
4358 else if (equalIgnoringCase(value, "off")) 4337 else if (equalIgnoringCase(value, "off"))
4359 mode = off; 4338 newValue = false;
4360 else 4339 if (newValue == m_designMode)
4361 mode = inherit; 4340 return;
4362 setDesignMode(mode); 4341 m_designMode = newValue;
4342 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::DesignMode));
4363 } 4343 }
4364 4344
4365 Document* Document::parentDocument() const 4345 Document* Document::parentDocument() const
4366 { 4346 {
4367 if (!m_frame) 4347 if (!m_frame)
4368 return 0; 4348 return 0;
4369 Frame* parent = m_frame->tree().parent(); 4349 Frame* parent = m_frame->tree().parent();
4370 if (!parent || !parent->isLocalFrame()) 4350 if (!parent || !parent->isLocalFrame())
4371 return 0; 4351 return 0;
4372 return toLocalFrame(parent)->document(); 4352 return toLocalFrame(parent)->document();
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
5751 #ifndef NDEBUG 5731 #ifndef NDEBUG
5752 using namespace blink; 5732 using namespace blink;
5753 void showLiveDocumentInstances() 5733 void showLiveDocumentInstances()
5754 { 5734 {
5755 WeakDocumentSet& set = liveDocumentSet(); 5735 WeakDocumentSet& set = liveDocumentSet();
5756 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5736 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5757 for (Document* document : set) 5737 for (Document* document : set)
5758 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5738 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5759 } 5739 }
5760 #endif 5740 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698