Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 3850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4307 { | 4307 { |
| 4308 ASSERT(!m_currentScriptStack.isEmpty()); | 4308 ASSERT(!m_currentScriptStack.isEmpty()); |
| 4309 m_currentScriptStack.removeLast(); | 4309 m_currentScriptStack.removeLast(); |
| 4310 } | 4310 } |
| 4311 | 4311 |
| 4312 void Document::setTransformSource(PassOwnPtr<TransformSource> source) | 4312 void Document::setTransformSource(PassOwnPtr<TransformSource> source) |
| 4313 { | 4313 { |
| 4314 m_transformSource = source; | 4314 m_transformSource = source; |
| 4315 } | 4315 } |
| 4316 | 4316 |
| 4317 void Document::setDesignMode(InheritedBool value) | |
| 4318 { | |
| 4319 m_designMode = value; | |
| 4320 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) { | |
| 4321 if (!frame->isLocalFrame()) | |
| 4322 continue; | |
| 4323 if (!toLocalFrame(frame)->document()) | |
| 4324 break; | |
| 4325 toLocalFrame(frame)->document()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::DesignMode)); | |
| 4326 } | |
| 4327 } | |
| 4328 | |
| 4329 bool Document::inDesignMode() const | |
| 4330 { | |
| 4331 for (const Document* d = this; d; d = d->parentDocument()) { | |
| 4332 if (d->m_designMode != inherit) | |
| 4333 return d->m_designMode; | |
| 4334 } | |
| 4335 return false; | |
| 4336 } | |
| 4337 | |
| 4338 String Document::designMode() const | 4317 String Document::designMode() const |
| 4339 { | 4318 { |
| 4340 return inDesignMode() ? "on" : "off"; | 4319 return inDesignMode() ? "on" : "off"; |
| 4341 } | 4320 } |
| 4342 | 4321 |
| 4343 void Document::setDesignMode(const String& value) | 4322 void Document::setDesignMode(const String& value) |
| 4344 { | 4323 { |
| 4345 InheritedBool mode; | |
| 4346 if (equalIgnoringCase(value, "on")) | 4324 if (equalIgnoringCase(value, "on")) |
| 4347 mode = on; | 4325 m_designMode = true; |
| 4348 else if (equalIgnoringCase(value, "off")) | 4326 else if (equalIgnoringCase(value, "off")) |
| 4349 mode = off; | 4327 m_designMode = false; |
| 4350 else | 4328 else |
| 4351 mode = inherit; | 4329 return; |
| 4352 setDesignMode(mode); | 4330 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::DesignMode)); |
|
yosin_UTC9
2015/03/24 05:18:38
nit: It is better to set style recalc when state w
dcheng
2015/03/26 01:53:14
Done.
| |
| 4353 } | 4331 } |
| 4354 | 4332 |
| 4355 Document* Document::parentDocument() const | 4333 Document* Document::parentDocument() const |
| 4356 { | 4334 { |
| 4357 if (!m_frame) | 4335 if (!m_frame) |
| 4358 return 0; | 4336 return 0; |
| 4359 Frame* parent = m_frame->tree().parent(); | 4337 Frame* parent = m_frame->tree().parent(); |
| 4360 if (!parent || !parent->isLocalFrame()) | 4338 if (!parent || !parent->isLocalFrame()) |
| 4361 return 0; | 4339 return 0; |
| 4362 return toLocalFrame(parent)->document(); | 4340 return toLocalFrame(parent)->document(); |
| (...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5741 #ifndef NDEBUG | 5719 #ifndef NDEBUG |
| 5742 using namespace blink; | 5720 using namespace blink; |
| 5743 void showLiveDocumentInstances() | 5721 void showLiveDocumentInstances() |
| 5744 { | 5722 { |
| 5745 WeakDocumentSet& set = liveDocumentSet(); | 5723 WeakDocumentSet& set = liveDocumentSet(); |
| 5746 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5724 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5747 for (Document* document : set) | 5725 for (Document* document : set) |
| 5748 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5726 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
| 5749 } | 5727 } |
| 5750 #endif | 5728 #endif |
| OLD | NEW |