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

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

Issue 23742003: Use css-device-adapt constraining for legacy viewport tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
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 25 matching lines...) Expand all
36 #include "XMLNSNames.h" 36 #include "XMLNSNames.h"
37 #include "XMLNames.h" 37 #include "XMLNames.h"
38 #include "bindings/v8/CustomElementConstructorBuilder.h" 38 #include "bindings/v8/CustomElementConstructorBuilder.h"
39 #include "bindings/v8/Dictionary.h" 39 #include "bindings/v8/Dictionary.h"
40 #include "bindings/v8/ExceptionMessages.h" 40 #include "bindings/v8/ExceptionMessages.h"
41 #include "bindings/v8/ExceptionState.h" 41 #include "bindings/v8/ExceptionState.h"
42 #include "bindings/v8/ExceptionStatePlaceholder.h" 42 #include "bindings/v8/ExceptionStatePlaceholder.h"
43 #include "bindings/v8/ScriptController.h" 43 #include "bindings/v8/ScriptController.h"
44 #include "core/accessibility/AXObjectCache.h" 44 #include "core/accessibility/AXObjectCache.h"
45 #include "core/animation/DocumentTimeline.h" 45 #include "core/animation/DocumentTimeline.h"
46 #include "core/css/CSSDefaultStyleSheets.h"
46 #include "core/css/CSSStyleDeclaration.h" 47 #include "core/css/CSSStyleDeclaration.h"
47 #include "core/css/CSSStyleSheet.h" 48 #include "core/css/CSSStyleSheet.h"
48 #include "core/css/FontLoader.h" 49 #include "core/css/FontLoader.h"
49 #include "core/css/MediaQueryMatcher.h" 50 #include "core/css/MediaQueryMatcher.h"
50 #include "core/css/StylePropertySet.h" 51 #include "core/css/StylePropertySet.h"
51 #include "core/css/StyleSheetContents.h" 52 #include "core/css/StyleSheetContents.h"
52 #include "core/css/StyleSheetList.h" 53 #include "core/css/StyleSheetList.h"
53 #include "core/css/resolver/StyleResolver.h" 54 #include "core/css/resolver/StyleResolver.h"
54 #include "core/dom/Attr.h" 55 #include "core/dom/Attr.h"
55 #include "core/dom/BeforeUnloadEvent.h" 56 #include "core/dom/BeforeUnloadEvent.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 , m_xmlStandalone(StandaloneUnspecified) 422 , m_xmlStandalone(StandaloneUnspecified)
422 , m_hasXMLDeclaration(0) 423 , m_hasXMLDeclaration(0)
423 , m_designMode(inherit) 424 , m_designMode(inherit)
424 , m_hasAnnotatedRegions(false) 425 , m_hasAnnotatedRegions(false)
425 , m_annotatedRegionsDirty(false) 426 , m_annotatedRegionsDirty(false)
426 , m_useSecureKeyboardEntryWhenActive(false) 427 , m_useSecureKeyboardEntryWhenActive(false)
427 , m_documentClasses(documentClasses) 428 , m_documentClasses(documentClasses)
428 , m_isViewSource(false) 429 , m_isViewSource(false)
429 , m_sawElementsInKnownNamespaces(false) 430 , m_sawElementsInKnownNamespaces(false)
430 , m_isSrcdocDocument(false) 431 , m_isSrcdocDocument(false)
432 , m_isMobileDocument(false)
431 , m_renderer(0) 433 , m_renderer(0)
432 , m_eventQueue(DocumentEventQueue::create(this)) 434 , m_eventQueue(DocumentEventQueue::create(this))
433 , m_weakFactory(this) 435 , m_weakFactory(this)
434 , m_idAttributeName(idAttr) 436 , m_idAttributeName(idAttr)
435 , m_hasFullscreenElementStack(false) 437 , m_hasFullscreenElementStack(false)
436 , m_loadEventDelayCount(0) 438 , m_loadEventDelayCount(0)
437 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 439 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
438 , m_referrerPolicy(ReferrerPolicyDefault) 440 , m_referrerPolicy(ReferrerPolicyDefault)
439 , m_directionSetOnDocumentElement(false) 441 , m_directionSetOnDocumentElement(false)
440 , m_writingModeSetOnDocumentElement(false) 442 , m_writingModeSetOnDocumentElement(false)
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 663 }
662 664
663 void Document::setDoctype(PassRefPtr<DocumentType> docType) 665 void Document::setDoctype(PassRefPtr<DocumentType> docType)
664 { 666 {
665 // This should never be called more than once. 667 // This should never be called more than once.
666 ASSERT(!m_docType || !docType); 668 ASSERT(!m_docType || !docType);
667 m_docType = docType; 669 m_docType = docType;
668 if (m_docType) { 670 if (m_docType) {
669 this->adoptIfNeeded(m_docType.get()); 671 this->adoptIfNeeded(m_docType.get());
670 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) 672 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false))
671 processViewport("width=device-width, height=device-height", Viewport Arguments::XHTMLMobileProfile); 673 m_isMobileDocument = true;
672 } 674 }
673 // Doctype affects the interpretation of the stylesheets. 675 // Doctype affects the interpretation of the stylesheets.
674 clearStyleResolver(); 676 clearStyleResolver();
675 } 677 }
676 678
677 DOMImplementation* Document::implementation() 679 DOMImplementation* Document::implementation()
678 { 680 {
679 if (!m_implementation) 681 if (!m_implementation)
680 m_implementation = DOMImplementation::create(this); 682 m_implementation = DOMImplementation::create(this);
681 return m_implementation.get(); 683 return m_implementation.get();
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 callback(keyString, valueString, this, data); 2918 callback(keyString, valueString, this, data);
2917 } 2919 }
2918 if (error) 2920 if (error)
2919 reportViewportWarning(this, InvalidKeyValuePairSeparatorError, String(), String()); 2921 reportViewportWarning(this, InvalidKeyValuePairSeparatorError, String(), String());
2920 } 2922 }
2921 2923
2922 void Document::processViewport(const String& features, ViewportArguments::Type o rigin) 2924 void Document::processViewport(const String& features, ViewportArguments::Type o rigin)
2923 { 2925 {
2924 ASSERT(!features.isNull()); 2926 ASSERT(!features.isNull());
2925 2927
2926 if (origin < m_viewportArguments.type) 2928 if (origin < m_legacyViewportArguments.type)
kenneth.r.christiansen 2013/09/02 09:14:16 I guess this needs a comment
rune 2013/09/02 11:53:39 Done.
2927 return; 2929 return;
2928 2930
2929 m_viewportArguments = ViewportArguments(origin); 2931 m_legacyViewportArguments = ViewportArguments(origin);
2930 processArguments(features, (void*)&m_viewportArguments, &setViewportFeature) ;
2931 2932
2932 updateViewportArguments(); 2933 processArguments(features, (void*)&m_legacyViewportArguments, &setViewportFe ature);
2934
2935 if (m_legacyViewportArguments.minZoom == ViewportArguments::ValueAuto)
2936 m_legacyViewportArguments.minZoom = 0.25;
2937
2938 if (m_legacyViewportArguments.maxZoom == ViewportArguments::ValueAuto) {
2939 m_legacyViewportArguments.maxZoom = 5;
2940 if (m_legacyViewportArguments.minZoom > 5)
2941 m_legacyViewportArguments.minZoom = 5;
2942 }
2943
2944 if (m_legacyViewportArguments.maxWidth == ViewportArguments::ValueAuto) {
2945
2946 if (m_legacyViewportArguments.zoom == ViewportArguments::ValueAuto) {
2947 m_legacyViewportArguments.minWidth = ViewportArguments::ValueExtendT oZoom;
2948 m_legacyViewportArguments.maxWidth = page()->settings().layoutFallba ckWidth();
2949 } else if (m_legacyViewportArguments.maxHeight == ViewportArguments::Val ueAuto) {
2950 m_legacyViewportArguments.minWidth = m_legacyViewportArguments.maxWi dth = ViewportArguments::ValueExtendToZoom;
2951 }
2952 }
2953
2954 if (m_viewportArguments.type != ViewportArguments::CSSDeviceAdaptation)
2955 useLegacyViewportArguments();
2933 } 2956 }
2934 2957
2935 void Document::updateViewportArguments() 2958 void Document::updateViewportArguments()
2936 { 2959 {
2937 if (page() && page()->mainFrame() == frame()) { 2960 if (page() && page()->mainFrame() == frame()) {
2938 #ifndef NDEBUG 2961 #ifndef NDEBUG
2939 m_didDispatchViewportPropertiesChanged = true; 2962 m_didDispatchViewportPropertiesChanged = true;
2940 #endif 2963 #endif
2941 page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments ); 2964 page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments );
2942 } 2965 }
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
5294 { 5317 {
5295 return DocumentLifecycleNotifier::create(this); 5318 return DocumentLifecycleNotifier::create(this);
5296 } 5319 }
5297 5320
5298 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5321 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5299 { 5322 {
5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5323 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5301 } 5324 }
5302 5325
5303 } // namespace WebCore 5326 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698