summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2016-04-16 22:39:22 +0100
committerJason Smith <jason.smith@xamarin.com>2016-04-16 14:39:22 -0700
commit2223efdd4ff740a9335cd0a41f0c0e406568ed3d (patch)
tree0e04dd1ffaf4636b9ed04181d36bf5856c11acac
parentd9ed63f0add8345cf6ab1508b353dcbdacbcd97c (diff)
downloadxamarin-forms-2223efdd4ff740a9335cd0a41f0c0e406568ed3d.tar.gz
xamarin-forms-2223efdd4ff740a9335cd0a41f0c0e406568ed3d.tar.bz2
xamarin-forms-2223efdd4ff740a9335cd0a41f0c0e406568ed3d.zip
[iOS] Restore VisualElementTracker on WebViewRenderer (#99)
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Resources/drawable/test.jpgbin0 -> 2212 bytes
-rw-r--r--Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj1
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj1
-rw-r--r--Xamarin.Forms.ControlGallery.iOS/test.jpgbin0 -> 2212 bytes
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39963.cs56
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs9
7 files changed, 64 insertions, 4 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/test.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/test.jpg
new file mode 100644
index 00000000..718bb181
--- /dev/null
+++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/test.jpg
Binary files differ
diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
index ab350370..c3717d60 100644
--- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
+++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj
@@ -193,6 +193,7 @@
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\drawable\coffee.png" />
<AndroidResource Include="Resources\drawable\toolbar_close.png" />
+ <AndroidResource Include="Resources\drawable\test.jpg" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\Icon.png" />
diff --git a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj
index 97791688..6bf11dfd 100644
--- a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj
+++ b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj
@@ -228,6 +228,7 @@
<BundleResource Include="Images\Vegetables.jpg" />
<BundleResource Include="Images\Vegetables%402x.jpg" />
<BundleResource Include="toolbar_close.png" />
+ <BundleResource Include="test.jpg" />
</ItemGroup>
<ItemGroup>
<Reference Include="Calabash, Version=18.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
diff --git a/Xamarin.Forms.ControlGallery.iOS/test.jpg b/Xamarin.Forms.ControlGallery.iOS/test.jpg
new file mode 100644
index 00000000..718bb181
--- /dev/null
+++ b/Xamarin.Forms.ControlGallery.iOS/test.jpg
Binary files differ
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39963.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39963.cs
new file mode 100644
index 00000000..8549e210
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39963.cs
@@ -0,0 +1,56 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 39963, "iOS WebView has wrong scrolling size when loading local html content with images")]
+ public class Bugzilla39963 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init()
+ {
+
+ var notWorkingHtml = @"<html><body>
+ <p><img src='test.jpg' /></p>
+ <p>After starting (not re-entering!) the app in landscape, scroll down to see a black area which is not supposed to be there.</p>
+ <p>After starting (not re-entering!) the app in portrait, scroll to the right to see a black area which is not supposed to be there.</p>
+ <p>This only happends when a local image is loaded.</p>
+ </body></html>";
+
+ var workingHtml = @"<html><body>
+ <p></p>
+ <p>Without local image, everything works fine.</p>
+ </body></html>";
+
+ // Initialize ui here instead of ctor
+ WebView webView = new WebView {
+ //Source = new UrlWebViewSource {
+ // Url = "https://blog.xamarin.com/",
+ //},
+ Source = new HtmlWebViewSource() {
+ Html = notWorkingHtml
+ },
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ };
+
+ Content = webView;
+ }
+
+#if UITEST
+ [Test]
+ public void Bugzilla39963Test()
+ {
+ RunningApp.Screenshot("I am at Bugzilla39963");
+ RunningApp.SwipeRightToLeft();
+ RunningApp.Screenshot("Do we see a black bar");
+ }
+#endif
+ }
+}
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 6a1e0b93..5eff8aef 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -399,6 +399,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39378.xaml.cs">
<DependentUpon>Bugzilla39378.xaml</DependentUpon>
</Compile>
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla39963.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
index 0c6c639b..577addb7 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
@@ -18,7 +18,9 @@ namespace Xamarin.Forms.Platform.iOS
bool _ignoreSourceChanges;
WebNavigationEvent _lastBackForwardEvent;
VisualElementPackager _packager;
-
+#pragma warning disable 0414
+ VisualElementTracker _tracker;
+#pragma warning restore 0414
public WebViewRenderer() : base(RectangleF.Empty)
{
}
@@ -47,6 +49,8 @@ namespace Xamarin.Forms.Platform.iOS
AutosizesSubviews = true;
AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
+ _tracker = new VisualElementTracker(this);
+
_packager = new VisualElementPackager(this);
_packager.Load();
@@ -62,9 +66,6 @@ namespace Xamarin.Forms.Platform.iOS
if (element != null)
element.SendViewInitialized(this);
-
- if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
- AccessibilityIdentifier = Element.AutomationId;
}
public void SetElementSize(Size size)