Changeset 163654 in webkit
- Timestamp:
- Feb 7, 2014 3:03:03 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r163651 r163654 1 2014-02-07 Benjamin Poulain <bpoulain@apple.com> 2 3 [WK2] Add support for text document viewport configuration 4 https://bugs.webkit.org/show_bug.cgi?id=128359 5 6 Reviewed by Simon Fraser. 7 8 Define a set of ViewportParameters suitable for displaying text documents. 9 Add a documents class for text document to differentiate them from other type of documents. 10 11 * WebCore.exp.in: 12 * dom/Document.h: 13 (WebCore::Document::isTextDocument): 14 * html/TextDocument.cpp: 15 (WebCore::TextDocument::TextDocument): 16 * page/ViewportConfiguration.cpp: 17 (WebCore::ViewportConfiguration::ViewportConfiguration): 18 (WebCore::ViewportConfiguration::webpageParameters): 19 (WebCore::ViewportConfiguration::plainTextParameters): 20 * page/ViewportConfiguration.h: 21 1 22 2014-02-07 Bem Jones-Bey <bjonesbe@adobe.com> 2 23 -
trunk/Source/WebCore/WebCore.exp.in
r163641 r163654 850 850 __ZN7WebCore21UserContentURLPattern5parseERKN3WTF6StringE 851 851 __ZN7WebCore21ViewportConfiguration15setContentsSizeERKNS_7IntSizeE 852 __ZN7WebCore21ViewportConfiguration17webpageParametersEv 853 __ZN7WebCore21ViewportConfiguration19plainTextParametersEv 852 854 __ZN7WebCore21ViewportConfiguration20setMinimumLayoutSizeERKNS_7IntSizeE 853 855 __ZN7WebCore21ViewportConfiguration20setViewportArgumentsERKNS_17ViewportArgumentsE -
trunk/Source/WebCore/dom/Document.h
r163568 r163654 241 241 MediaDocumentClass = 1 << 4, 242 242 SVGDocumentClass = 1 << 5, 243 TextDocumentClass = 1 << 6 243 244 }; 244 245 … … 482 483 bool isPluginDocument() const { return m_documentClasses & PluginDocumentClass; } 483 484 bool isMediaDocument() const { return m_documentClasses & MediaDocumentClass; } 485 bool isTextDocument() const { return m_documentClasses & TextDocumentClass; } 484 486 bool hasSVGRootNode() const; 485 487 virtual bool isFrameSet() const { return false; } -
trunk/Source/WebCore/html/TextDocument.cpp
r156980 r163654 31 31 32 32 TextDocument::TextDocument(Frame* frame, const URL& url) 33 : HTMLDocument(frame, url )33 : HTMLDocument(frame, url, TextDocumentClass) 34 34 { 35 35 setCompatibilityMode(QuirksMode); -
trunk/Source/WebCore/page/ViewportConfiguration.cpp
r163515 r163654 30 30 #include <wtf/MathExtras.h> 31 31 32 #if PLATFORM(IOS) 33 #include "WebCoreSystemInterface.h" 34 #endif 35 32 36 namespace WebCore { 33 37 … … 45 49 // Setup a reasonable default configuration to avoid computing infinite scale/sizes. 46 50 // Those are the original iPhone configuration. 47 m_defaultConfiguration.width = 980; 48 m_defaultConfiguration.widthIsSet = true; 49 m_defaultConfiguration.allowsUserScaling = true; 50 m_defaultConfiguration.minimumScale = 0.25; 51 m_defaultConfiguration.maximumScale = 5; 51 m_defaultConfiguration = ViewportConfiguration::webpageParameters(); 52 52 updateConfiguration(); 53 53 } … … 139 139 140 140 return minimumScale; 141 } 142 143 ViewportConfiguration::Parameters ViewportConfiguration::webpageParameters() 144 { 145 Parameters parameters; 146 parameters.width = 980; 147 parameters.widthIsSet = true; 148 parameters.allowsUserScaling = true; 149 parameters.minimumScale = 0.25; 150 parameters.maximumScale = 5; 151 return parameters; 152 } 153 154 ViewportConfiguration::Parameters ViewportConfiguration::plainTextParameters() 155 { 156 Parameters parameters; 157 158 #if PLATFORM(IOS) 159 parameters.width = static_cast<int>(wkGetViewportScreenSize().width); 160 #else 161 // FIXME: this needs to be unified with ViewportArguments on all ports. 162 parameters.width = 320; 163 #endif 164 165 parameters.widthIsSet = true; 166 parameters.allowsUserScaling = true; 167 parameters.minimumScale = 0.25; 168 parameters.maximumScale = 5; 169 return parameters; 141 170 } 142 171 -
trunk/Source/WebCore/page/ViewportConfiguration.h
r163515 r163654 83 83 bool allowsUserScaling() const { return m_configuration.allowsUserScaling; } 84 84 85 static Parameters webpageParameters(); 86 static Parameters plainTextParameters(); 87 85 88 private: 86 89 void updateConfiguration(); -
trunk/Source/WebKit2/ChangeLog
r163647 r163654 1 2014-02-07 Benjamin Poulain <bpoulain@apple.com> 2 3 [WK2] Add support for text document viewport configuration 4 https://bugs.webkit.org/show_bug.cgi?id=128359 5 6 Reviewed by Simon Fraser. 7 8 When a text document is being loaded, use the plainText viewport parameters. 9 10 * UIProcess/API/ios/WKContentView.h: 11 * UIProcess/API/ios/WKContentView.mm: 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::didCommitLoad): 14 1 15 2014-02-07 Gavin Barraclough <barraclough@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h
r163515 r163654 33 33 @class WKWebViewConfiguration; 34 34 35 typedef NS_ENUM(unsigned, WKContentType)36 {37 Standard = 0,38 PlainText,39 Image40 };41 42 35 namespace WebKit { 43 36 class RemoteLayerTreeTransaction; … … 56 49 57 50 @property (nonatomic, assign) id <WKContentViewDelegate> delegate; 58 @property (nonatomic, readonly) WKContentType contentType;59 51 60 52 @property (readonly) WKPageRef _pageRef; -
trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm
r163572 r163654 158 158 } 159 159 160 - (WKContentType)contentType161 {162 if (_page->mainFrame()->mimeType() == "text/plain")163 return WKContentType::PlainText;164 else if (_page->mainFrame()->isDisplayingStandaloneImageDocument())165 return WKContentType::Image;166 return WKContentType::Standard;167 }168 169 160 - (WKPageRef)_pageRef 170 161 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r163647 r163654 3960 3960 m_userHasChangedPageScaleFactor = false; 3961 3961 3962 // FIXME: Setup a real configuration. 3963 ViewportConfiguration::Parameters defaultConfiguration; 3964 defaultConfiguration.width = 980; 3965 defaultConfiguration.widthIsSet = true; 3966 defaultConfiguration.allowsUserScaling = true; 3967 defaultConfiguration.minimumScale = 0.25; 3968 defaultConfiguration.maximumScale = 5; 3969 3970 m_viewportConfiguration.setDefaultConfiguration(defaultConfiguration); 3962 if (frame->coreFrame()->document()->isTextDocument()) 3963 m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::plainTextParameters()); 3964 else 3965 m_viewportConfiguration.setDefaultConfiguration(ViewportConfiguration::webpageParameters()); 3966 3971 3967 m_viewportConfiguration.setViewportArguments(ViewportArguments()); 3972 3968 m_viewportConfiguration.setContentsSize(m_viewportConfiguration.minimumLayoutSize());
Note: See TracChangeset
for help on using the changeset viewer.