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 25 matching lines...) Expand all Loading... | |
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 Loading... | |
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_contextDocument(initializer.contextDocument()) | 436 , m_contextDocument(initializer.contextDocument()) |
435 , m_idAttributeName(idAttr) | 437 , m_idAttributeName(idAttr) |
436 , m_hasFullscreenElementStack(false) | 438 , m_hasFullscreenElementStack(false) |
437 , m_loadEventDelayCount(0) | 439 , m_loadEventDelayCount(0) |
438 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) | 440 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) |
439 , m_referrerPolicy(ReferrerPolicyDefault) | 441 , m_referrerPolicy(ReferrerPolicyDefault) |
440 , m_directionSetOnDocumentElement(false) | 442 , m_directionSetOnDocumentElement(false) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 } | 664 } |
663 | 665 |
664 void Document::setDoctype(PassRefPtr<DocumentType> docType) | 666 void Document::setDoctype(PassRefPtr<DocumentType> docType) |
665 { | 667 { |
666 // This should never be called more than once. | 668 // This should never be called more than once. |
667 ASSERT(!m_docType || !docType); | 669 ASSERT(!m_docType || !docType); |
668 m_docType = docType; | 670 m_docType = docType; |
669 if (m_docType) { | 671 if (m_docType) { |
670 this->adoptIfNeeded(m_docType.get()); | 672 this->adoptIfNeeded(m_docType.get()); |
671 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) | 673 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) |
672 processViewport("width=device-width, height=device-height", Viewport Arguments::XHTMLMobileProfile); | 674 m_isMobileDocument = true; |
kenneth.r.christiansen
2013/09/04 11:39:01
Hack using viewport meta, removed
| |
673 } | 675 } |
674 // Doctype affects the interpretation of the stylesheets. | 676 // Doctype affects the interpretation of the stylesheets. |
675 clearStyleResolver(); | 677 clearStyleResolver(); |
676 } | 678 } |
677 | 679 |
678 DOMImplementation* Document::implementation() | 680 DOMImplementation* Document::implementation() |
679 { | 681 { |
680 if (!m_implementation) | 682 if (!m_implementation) |
681 m_implementation = DOMImplementation::create(this); | 683 m_implementation = DOMImplementation::create(this); |
682 return m_implementation.get(); | 684 return m_implementation.get(); |
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2917 callback(keyString, valueString, this, data); | 2919 callback(keyString, valueString, this, data); |
2918 } | 2920 } |
2919 if (error) | 2921 if (error) |
2920 reportViewportWarning(this, InvalidKeyValuePairSeparatorError, String(), String()); | 2922 reportViewportWarning(this, InvalidKeyValuePairSeparatorError, String(), String()); |
2921 } | 2923 } |
2922 | 2924 |
2923 void Document::processViewport(const String& features, ViewportArguments::Type o rigin) | 2925 void Document::processViewport(const String& features, ViewportArguments::Type o rigin) |
2924 { | 2926 { |
2925 ASSERT(!features.isNull()); | 2927 ASSERT(!features.isNull()); |
2926 | 2928 |
2927 if (origin < m_viewportArguments.type) | 2929 // We are adding viewport properties from a legacy meta tag. |
2930 // The different meta tags have different priorities based on the type regar dless | |
2931 // of which order they appear in the DOM. The priority is given by the | |
2932 // ViewportArguments::Type enum. If we process viewport properties with a lo wer | |
2933 // priority than an already processed meta tag, just ignore it. | |
2934 if (origin < m_legacyViewportArguments.type) | |
2928 return; | 2935 return; |
2929 | 2936 |
2930 m_viewportArguments = ViewportArguments(origin); | 2937 // Overwrite viewport arguments from previously encountered meta tags. |
2931 processArguments(features, (void*)&m_viewportArguments, &setViewportFeature) ; | 2938 m_legacyViewportArguments = ViewportArguments(origin); |
2932 | 2939 |
2933 updateViewportArguments(); | 2940 processArguments(features, (void*)&m_legacyViewportArguments, &setViewportFe ature); |
2941 | |
2942 if (m_legacyViewportArguments.minZoom == ViewportArguments::ValueAuto) | |
2943 m_legacyViewportArguments.minZoom = 0.25; | |
2944 | |
2945 if (m_legacyViewportArguments.maxZoom == ViewportArguments::ValueAuto) { | |
2946 m_legacyViewportArguments.maxZoom = 5; | |
2947 if (m_legacyViewportArguments.minZoom > 5) | |
2948 m_legacyViewportArguments.minZoom = 5; | |
2949 } | |
2950 | |
2951 if (m_legacyViewportArguments.maxWidth.isAuto()) { | |
2952 | |
2953 if (m_legacyViewportArguments.zoom == ViewportArguments::ValueAuto) { | |
2954 m_legacyViewportArguments.minWidth = Length(ExtendToZoom); | |
2955 m_legacyViewportArguments.maxWidth = Length(page()->settings().layou tFallbackWidth(), Fixed); | |
2956 } else if (m_legacyViewportArguments.maxHeight.isAuto()) { | |
2957 m_legacyViewportArguments.minWidth = m_legacyViewportArguments.maxWi dth = Length(ExtendToZoom); | |
2958 } | |
2959 } | |
2960 | |
2961 // When no author style for @viewport is present, and a meta tag for definin g the | |
2962 // viewport is present, apply the meta tag viewport arguments instead of the UA styles. | |
2963 if (m_viewportArguments.type != ViewportArguments::AuthorStyleSheet) { | |
2964 m_viewportArguments = m_legacyViewportArguments; | |
2965 updateViewportArguments(); | |
2966 } | |
2934 } | 2967 } |
2935 | 2968 |
2936 void Document::updateViewportArguments() | 2969 void Document::updateViewportArguments() |
2937 { | 2970 { |
2938 if (page() && page()->mainFrame() == frame()) { | 2971 if (page() && page()->mainFrame() == frame()) { |
2939 #ifndef NDEBUG | 2972 #ifndef NDEBUG |
2940 m_didDispatchViewportPropertiesChanged = true; | 2973 m_didDispatchViewportPropertiesChanged = true; |
2941 #endif | 2974 #endif |
2942 page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments ); | 2975 page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments ); |
2943 } | 2976 } |
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5321 { | 5354 { |
5322 return DocumentLifecycleNotifier::create(this); | 5355 return DocumentLifecycleNotifier::create(this); |
5323 } | 5356 } |
5324 | 5357 |
5325 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5358 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5326 { | 5359 { |
5327 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); | 5360 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); |
5328 } | 5361 } |
5329 | 5362 |
5330 } // namespace WebCore | 5363 } // namespace WebCore |
OLD | NEW |