Guest User

Untitled

a guest
Jan 20th, 2017
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.80 KB | None | 0 0
  1. From b4bc7aae23505bee1f2879c44f2fb727e76c36c0 Mon Sep 17 00:00:00 2001
  2. From: anonymous <[email protected]>
  3. Date: Sat, 21 Jan 2017 02:15:20 +0200
  4. Subject: [PATCH] TWEAK_LOGDOC_LOAD_IMAGES_FROM_PARSER turned into two
  5. preferences
  6.  
  7. ---
  8. modules/logdoc/module.tweaks | 22 ++++++++++++++++++----
  9. modules/logdoc/src/htm_elm.cpp | 13 ++++++++-----
  10. modules/logdoc/src/htm_ldoc.cpp | 23 +++++++++++++++++------
  11. modules/prefs/prefsmanager/collections/pc_doc.txt | 16 ++++++++++++++++
  12. 4 files changed, 59 insertions(+), 15 deletions(-)
  13.  
  14. diff --git a/modules/logdoc/module.tweaks b/modules/logdoc/module.tweaks
  15. index b4a7738..03d6158 100644
  16. --- a/modules/logdoc/module.tweaks
  17. +++ b/modules/logdoc/module.tweaks
  18. @@ -349,7 +349,7 @@ TWEAK_LOGDOC_IGNORE_SCHEMES_WITH_TABS_OR_NEW_LINES pstanek
  19. Enabled for : minimal
  20. Disabled for : smartphone, desktop, tv, mini
  21.  
  22. -TWEAK_LOGDOC_LOAD_IMAGES_FROM_PARSER pstanek
  23. +TWEAK_LOGDOC_LOAD_IMAGES_FROM_PARSER_DEFAULT anonymous
  24.  
  25. Moves images loading from the layout to the parser.
  26. This may cause more images will be loaded (even the ones which are hidden)
  27. @@ -357,9 +357,23 @@ TWEAK_LOGDOC_LOAD_IMAGES_FROM_PARSER pstanek
  28. May have also impact on loading performace.
  29.  
  30. Category : performance
  31. - Define : LOGDOC_LOAD_IMAGES_FROM_PARSER
  32. - Enabled for : desktop, tv, mini
  33. - Disabled for: smartphone, minimal
  34. + Define : DEFAULT_LOGDOC_LOAD_IMAGES_FROM_PARSER
  35. + Value : FALSE
  36. + Value for desktop, tv, smartphone, minimal: FALSE
  37. + Value for mini: TRUE
  38. +
  39. +TWEAK_LOGDOC_LOAD_IMAGES_FROM_PARSER_FOR_CANVAS_DEFAULT anonymous
  40. +
  41. + Moves images loading from the layout to the parser if canvas support is
  42. + turned on. This may cause more images will be loaded (even the ones which
  43. + are hidden) but will reduce page compatibility problems.
  44. + May have also impact on loading performace.
  45. +
  46. + Category : performance
  47. + Define : DEFAULT_LOGDOC_LOAD_IMAGES_FROM_PARSER_FOR_CANVAS
  48. + Value : FALSE
  49. + Value for desktop, tv, smartphone, minimal: FALSE
  50. + Value for mini: TRUE
  51.  
  52. TWEAK_LOGDOC_INCREASE_FONTSIZE_QUIRK deprecated
  53.  
  54. diff --git a/modules/logdoc/src/htm_elm.cpp b/modules/logdoc/src/htm_elm.cpp
  55. index 59c3783..59aa720 100644
  56. --- a/modules/logdoc/src/htm_elm.cpp
  57. +++ b/modules/logdoc/src/htm_elm.cpp
  58. @@ -17138,14 +17138,17 @@ HTML_Element::GetUrlAttr(short attr, int ns_idx/*=NS_IDX_HTML*/, LogicalDocument
  59. }
  60. #endif // WEB_TURBO_MODE
  61.  
  62. -#if defined LOGDOC_LOAD_IMAGES_FROM_PARSER && defined _WML_SUPPORT_
  63. +#if defined _WML_SUPPORT_
  64. /* In WML images may have attribute set to some variable. Moreover variable value may be set later than during parsing - e.g. by the timer - so
  65. * in such a case, if URL can not be resolved, do not cache it.
  66. */
  67. - if (logdoc && Type() == HE_IMG && ret_url.IsEmpty() && logdoc->GetHLDocProfile()->IsWml() && logdoc->GetHLDocProfile()->HasWmlContent() &&
  68. - logdoc->GetHLDocProfile()->WMLGetContext()->NeedSubstitution(url_str, uni_strlen(url_str)))
  69. - return NULL;
  70. -#endif // LOGDOC_LOAD_IMAGES_FROM_PARSER && _WML_SUPPORT_
  71. + if (g_pcdoc->GetIntegerPref(PrefsCollectionDoc::LoadImagesFromParser))
  72. + {
  73. + if (logdoc && Type() == HE_IMG && ret_url.IsEmpty() && logdoc->GetHLDocProfile()->IsWml() && logdoc->GetHLDocProfile()->HasWmlContent() &&
  74. + logdoc->GetHLDocProfile()->WMLGetContext()->NeedSubstitution(url_str, uni_strlen(url_str)))
  75. + return NULL;
  76. + }
  77. +#endif // _WML_SUPPORT_
  78.  
  79. if (OpStatus::IsMemoryError(url_attr->SetResolvedUrl(ret_url)))
  80. return NULL;
  81. diff --git a/modules/logdoc/src/htm_ldoc.cpp b/modules/logdoc/src/htm_ldoc.cpp
  82. index 9563159..c6985e8 100644
  83. --- a/modules/logdoc/src/htm_ldoc.cpp
  84. +++ b/modules/logdoc/src/htm_ldoc.cpp
  85. @@ -2270,8 +2270,7 @@ HLDocProfile::InsertElementInternal(HTML_Element *parent, HTML_Element *new_elm,
  86. SetIsOutOfMemory(TRUE);
  87. }
  88.  
  89. -#ifdef LOGDOC_LOAD_IMAGES_FROM_PARSER
  90. - else if (new_elm->GetInputType() == INPUT_IMAGE)
  91. + else if (g_pcdoc->GetIntegerPref(PrefsCollectionDoc::LoadImagesFromParser) && new_elm->GetInputType() == INPUT_IMAGE)
  92. {
  93. URL inline_url = new_elm->GetImageURL(FALSE, GetLogicalDocument());
  94.  
  95. @@ -2282,7 +2281,6 @@ HLDocProfile::InsertElementInternal(HTML_Element *parent, HTML_Element *new_elm,
  96. SetIsOutOfMemory(TRUE);
  97. }
  98. }
  99. -#endif // LOGDOC_LOAD_IMAGES_FROM_PARSER
  100.  
  101. SetElementNumberWithinForm(this, new_elm);
  102. SetElementFormNumber(this, new_elm);
  103. @@ -2336,9 +2334,22 @@ HLDocProfile::InsertElementInternal(HTML_Element *parent, HTML_Element *new_elm,
  104. case HE_IMG:
  105. {
  106. SetElementFormNumber(this, new_elm);
  107. -#if !defined(LOGDOC_LOAD_IMAGES_FROM_PARSER) && !defined(CANVAS_SUPPORT)
  108. - if ((new_elm->HasAttr(ATTR_ONLOAD) || new_elm->HasAttr(ATTR_ONERROR)) && !new_elm->GetHEListElmForInline(IMAGE_INLINE))
  109. -#endif // !LOGDOC_LOAD_IMAGES_FROM_PARSER && !CANVAS_SUPPORT
  110. + bool doLoadImgNow = false;
  111. +#if defined(CANVAS_SUPPORT)
  112. + doLoadImgNow = g_pcdoc->GetIntegerPref(PrefsCollectionDoc::AlwaysLoadImagesFromParserForCanvas);
  113. +#endif
  114. + if (!g_pcdoc->GetIntegerPref(PrefsCollectionDoc::LoadImagesFromParser))
  115. + {
  116. + doLoadImgNow = doLoadImgNow || ((new_elm->HasAttr(ATTR_ONLOAD) || new_elm->HasAttr(ATTR_ONERROR)) && !new_elm->GetHEListElmForInline(IMAGE_INLINE));
  117. + }
  118. + else
  119. + {
  120. + doLoadImgNow = true;
  121. + }
  122. +//#if !defined(LOGDOC_LOAD_IMAGES_FROM_PARSER) && !defined(CANVAS_SUPPORT)
  123. +// if ((new_elm->HasAttr(ATTR_ONLOAD) || new_elm->HasAttr(ATTR_ONERROR)) && !new_elm->GetHEListElmForInline(IMAGE_INLINE))
  124. +//#endif // !LOGDOC_LOAD_IMAGES_FROM_PARSER && !CANVAS_SUPPORT
  125. + if (doLoadImgNow)
  126. {
  127. /* There are three reasons we might choose to load the image now.
  128. 1. The tweak to load images from the parser is enabled.
  129. diff --git a/modules/prefs/prefsmanager/collections/pc_doc.txt b/modules/prefs/prefsmanager/collections/pc_doc.txt
  130. index f7e41e7..2d47a6b 100644
  131. --- a/modules/prefs/prefsmanager/collections/pc_doc.txt
  132. +++ b/modules/prefs/prefsmanager/collections/pc_doc.txt
  133. @@ -508,4 +508,20 @@ Type: boolean
  134. Description: Draw images instantly
  135. Default: DEFAULT_TURBO_MODE
  136.  
  137. +Preference: LoadImagesFromParser
  138. +Depends on:
  139. +Section: Performance
  140. +Key: Load Images From Parser
  141. +Type: boolean
  142. +Description: Load images from parser. Turning this on speeds up page loading, but Opera may fetch some hidden images.
  143. +Default: DEFAULT_LOGDOC_LOAD_IMAGES_FROM_PARSER
  144. +
  145. +Preference: AlwaysLoadImagesFromParserForCanvas
  146. +Depends on:
  147. +Section: Performance
  148. +Key: Always Load Images From Parser For Canvas
  149. +Type: boolean
  150. +Description: Always load images from parser if canvas support is turned on. Turning this off speeds up page loading, but may break web.
  151. +Default: DEFAULT_LOGDOC_LOAD_IMAGES_FROM_PARSER_FOR_CANVAS
  152. +
  153. .eof
  154. --
  155. 2.9.2
Add Comment
Please, Sign In to add comment