Commit Graph

66 Commits

Author SHA1 Message Date
Pranav K 5f66403248 Remove TextWriter.ToString from RazorPage
Fixes #3668
2015-12-18 09:12:28 -08:00
Pranav K c5b6efd6bf Move buffer types to ViewFeatures
Use buffer pooling in more places
2015-12-17 21:05:18 -08:00
Pranav K ff34c5404a Implement a backing-buffer for Razor using pooled memory
Fixes #3532
2015-12-03 17:42:20 -08:00
Doug Bunting 1f76b3c7b7 Clean up remaining `HtmlString` usage
- #3122 and #3123 (5 of 5)
- avoid concatenating values and wrapping them in an `HtmlString`
  - switch from `string.Format()` to `AppendHtml()` in `LinkTagHelper`
  - simplify `RazorPage` and `TagHelperContentExtensions` e.g. don't use a `TagHelperContentWrapperTextWriter`
  - add some special cases in `UrlResolutionTagHelper`
- add `TagBuilder` and `StringHtmlContent` special cases to avoid `StringWriter` use when value is an `HtmlString`
- move `HtmlTextWriter` optimizations a bit lower and add missing checks for that type

nits:
- correct comments that incorrectly mention `HtmlString`s
- update comments in `JavaScriptStringArrayEncoder`
2015-12-03 15:37:44 -08:00
Ryan Nowak 9fc3a80056 Remove IActionContextAccessor from UrlHelper
This change removes the IActionContextAccessor as a dependency of
UrlHelper, and shifts UrlHelper to use a factory pattern. Consumers of
IUrlHelper should create an instance using the factory when needed.

This is the last part of MVC that has a dependency on IActionContext
accessor. As part of this change we no longer register it by default, and
treat it as an optional component.
2015-12-02 17:09:43 -08:00
Pranav K 7e2eb16960 React to Microsoft.AspNet.Html namespace rename 2015-12-02 11:15:54 -08:00
Pranav K 70bdb6eb3e Removing CopyTo from RazorTextWriter 2015-12-01 12:37:11 -08:00
Pranav K 79d517483b Removing PageInstrumentation
Fixes #3497
2015-11-25 08:41:21 -08:00
N. Taylor Mullen 2dc13b523d React to aspnet/Razor#358.
- Removed `WriteTagHelperAsync` methods from `RazorPage`.
- Moved `WriteTagHelperAsync` tests into Razor since `TagHelperOutput` is now an `IHtmlContent`.
- Updated code generation test files.

aspnet/Razor#358
2015-11-20 10:05:48 -08:00
Doug Bunting 3be6167aa0 Switch concepts from misnamed `isPartial` to `isMainPage`
- `true` has the opposite meaning now but most changes are due to new parameters names in `IViewEngine`
  - use name names in `Microsoft.AspNet.Mvc.ViewFound` and not found events
- remove `IRazorPage.IsPartial` and `RazorView.IsPartial`
  - remove `IsPartial` properties from `Microsoft.AspNet.Mvc.Razor.BeginInstrumentationContext` and end events
- add parameter checks to `RazorView` constructor; instances are not retrieved from DI

nits:
- remove unused `cacheKey` parameter from `RazorViewEngine.CreateCacheResult()`
- correct duplicate test names in `RazorPageTest`
  - also `...OnPageExecutionListenerContext` -> `...OnPageExecutionContext`
2015-11-18 15:59:37 -08:00
Pranav K d17db92e19 Log messages to DiagnosticListener in addition to page instrumentation
Fixes #3281
2015-11-09 10:24:49 -08:00
Chris R 52f4a83139 React to WebEncoders changes. 2015-10-30 17:59:19 -07:00
Doug Bunting c267ef3904 Rename `AppendEncoded()` to `AppendHtml()` and `SetContentEncoded()` to `SetHtmlContent()`
- #3225, 3 of 3
2015-10-22 16:57:47 -07:00
N. Taylor Mullen 0ae83a25e9 React to aspnet/Razor#571.
- Changed all `GetChildContentAsync` calls to come from `TagHelperOutput` instead of `TagHelperContext`.
- Updated `ReaderAtEndOfFormTagHelper` to properly detect changes inside of a `Form`s body by calling the `Init` method.
- Add test to `RenderAtEndOfFormTagHelperTest`.

aspnet/Razor#571
2015-10-22 14:51:14 -07:00
N. Taylor Mullen 0e25470660 React to aspnet/Razor#578. 2015-10-22 14:41:40 -07:00
Pranav K f57e180971 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:53 -07:00
Pranav K 2028351bb8 React to WriteAttribute \ AddHtmlAttribute API changes 2015-10-01 10:19:14 -07:00
Pranav K 18c80d156c Replace NotNullAttribute with thrown exceptions 2015-09-26 23:48:43 -07:00
Ryan Nowak 80add92de8 React to removal of TagHelperContent.ToString()
Avoid calling ToString on a TagHelperContent.

Also react to new properties on TagHelperCodeGenerationContext
2015-09-23 11:09:27 -07:00
Kiran Challa b7382dc6c3 Fix Razor test compilation failure 2015-09-17 16:47:07 -07:00
Pranav K 7b433820b1 Changes per PR comments
Reformatting parameter identation
2015-09-17 15:42:58 -07:00
Pranav K a68d9e4cb1 Replace NotNullAttribute with thrown exceptions 2015-09-17 11:56:44 -07:00
Ryan Nowak 538cd9c191 Move less-commonly used types out of .Rendering 2015-09-16 23:52:29 -07:00
Ryan Nowak 9a15b54d30 Flow IHtmlContent through to the razor buffer 2015-09-16 16:17:40 -07:00
Ryan Nowak 94388a8804 React to BufferedHtmlContent changes 2015-09-13 13:51:53 -07:00
N. Taylor Mullen cc5c0d6cbe Update `HelperResult` to take in an async func.
- The corresponding Razor change results in `HelperResult`s being rendered with async lambdas.
- This change enables `TagHelper`s and other async code to exist inside of `HelperResult` blocks.
- Added test to validate Templates (they generate `HelperResult`s) can utilize `TagHelper`s correctly.
- Rename `RazorPage`s `RenderBodyDelegate` to `RenderBodyDelegateAsync`.

aspnet/Razor#494
2015-08-25 22:37:17 -07:00
N. Taylor Mullen 1b51f6bca6 Enable input, image and url resolution `TagHelper`s to be written as void elements.
- Razor rendering now understands `TagMode` which allows void elements to be rendered.
- Added a `TagStructure.WithoutEnd` bit to `InputTagHelper`, `ImageTagHelper` and `UrlResolutionTagHelper`. This will allow users to write the various elements in the void format. Used the HTML5 spec to determine the elements appropriate.
- Added tests to ensure `TagMode.StartTagOnly` is rendered properly.
- Updated a few functional tests to showcase the void element formats.

aspnet/Razor#450
2015-08-13 16:19:28 -07:00
sornaks b6a109e2a3 Making DefaultDisplayTemplates and DefaultEditorTemplates use IHtmlContent.
- Making TagBuilder's InnerHtml an IHtmlContent.
- Delay encoding until the content is written.
- Moving BufferedHtmlContent to Common cos it is used in aspnet/Razor also.
- Changing GenerateOption to take in a string and create StringHtmlContent.
- This reduces the space used by around 13%.
2015-08-10 14:55:34 -07:00
N. Taylor Mullen a0da6ec19f Add `AddHtmlAttributeValues` for `TagHelper`s.
- Refactored `WriteAttributeTo` to allow re-use of some of the core attribute writing logic. The refactoring was based on removing the `Begin`/`EndContext` for instrumentation bits which isn't valid in a `TagHelper` attribute scenario.
- Added unit tests to validate attributes are properly added to `TagHelperExecutionContext`.
- Added functional test to validate everything is output as expected with dynamic attributes (encoded and non-encoded).

aspnet/Razor#247
2015-08-10 12:06:02 -07:00
N. Taylor Mullen c8df81ef91 React to aspnet/Razor#459. 2015-07-31 15:47:29 -07:00
Ajay Bhargav Baaskaran e4049c07eb Razor boolean and null attribute special case handled correctly
- Issue #2769
 - Special case is only applied to null and bool value with no surrounding
   whitespace
2015-07-30 10:37:38 -07:00
sornaks a02082397a Introducing IHtmlContent in Mvc.Razor.
- Changing HtmlHelper and HelperResult to implement IHtmlContent.
- Introducing BufferedHtmlContent.
- Making RazorPage handle only IHtmlContent and clearing out other types.
- Making StringCollectionTextWriter use BufferedHtmlContent so that it can be returned where necessary.
- Updating places which involve Write/Copy to pass in encoders.
- The encoders are currently not being used during write. But when HtmlString is modified to carry encode metadata, the encoder can be used for writing. This is a perf optimization and hence not a part of this change.
- Making TagHelperContent implement IHtmlContent.
2015-07-10 16:24:32 -07:00
Ajay Bhargav Baaskaran 48e0b3261c [Fixes #2547] Fixed attribute value prefix with dynamic content being ignored 2015-05-18 17:15:38 -07:00
N. Taylor Mullen 12e4307f3a Add tests to account for aspnet/Razor#220.
- Added unit and functional test.
2015-05-15 12:13:15 -07:00
Kirthi Krishnamraju caa8ea44fb Fix #448: Support app-wide defaults for HTML helpers 2015-05-12 14:10:59 -07:00
Chris R bd03142dab React to Http namespace changes. 2015-05-07 15:19:10 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
N. Taylor Mullen f152ea7004 React to aspnet/Razor#279 changes.
- Updated all tests and TagHelpers to utilize the new TagHelperOutput.Attributes and TagHelperContext.AllAttribute types.

aspnet/Razor#279
2015-04-27 14:30:30 -07:00
Ryan Nowak 572e57e25c Create Mvc.Abstractions
Creates a new package 'Microsoft.AspNet.Mvc.Abstractions' which defines
APIs and contracts for core concepts and extensibility points in MVC.

Includes:
- ModelBinding
- Validation
- Model State
- Model Metadata
- Action Descriptors
- IActionResult
- Filters
- IActionConstraint
2015-04-27 00:49:14 -07:00
Ajay Bhargav Baaskaran 5da8ba7769 [Fixes #2085] Using custom HtmlEncoder in unit tests 2015-04-23 13:16:27 -07:00
Ajay Bhargav Baaskaran f878ca5b15 [Fixes #1919] Added path info to RazorPage exceptions 2015-04-17 10:30:37 -07:00
Chris Ross 6223aac9be Handle Http.Core rename. 2015-04-16 15:48:27 -07:00
N. Taylor Mullen 2c4c35e126 Add rendering logic for PreElement and PostElement on TagHelperOutput.
- Added unit tests to validate that the properties were rendered correctly.
- Modified functional tests to utilize PreElement and PostElement.

aspnet/Razor#341
2015-04-14 12:01:20 -07:00
Doug Bunting 36bd387686 Merge remote-tracking branch 'origin/release' into dev 2015-03-30 11:44:35 -07:00
Doug Bunting 5882cdb03f MVC portion of aspnet/Razor#335
- set correct `MarkAsHtmlEncodedMethodName` value in `MvcRazorHost`
- handle `HtmlString` values in `TagHelperOutput.Attributes` in `RazorPage`
 - special-case double-quotes in `HtmlString` values
 - add `static WriteTo()` method for use in tag helpers
- handle non-`string` `output.Attributes` values in tag helpers
- make `TagHelperContentWrapperTextWriter` a `public` class
- provide a `TagHelperContent.Append(object, ...)` extension method
- add `LinkTagHelper.Href` and `ScriptTagHelper.Src` properties
 - avoid Razor HTML-encoding these attribute values before their use
- add `JavaScriptEncoder` properties in `LinkTagHelper` and `ScriptTagHelper`
 - allow encoding testing without unit testing the default encoder
- handle MVC and Razor changes for this bug in existing tests
- add functional tests of encodings
- add test encoders to TestCommon project

nits:
- correct `InputTagHelper` to pass `type=""` through unchanged
- set correct `TagHelperContentTypeName` value in `MvcRazorHost`
- remove unnecessary `FormTagHelper.Method` and `OptionTagHelper.Selected` properties
- remove complex ternaries and `ShouldAddFileVersion()` methods
- add a few debug assertions
- fix some odd wrapping
- remove or `#if`-out unused `using`s
- remove trailing whitespace
2015-03-30 10:54:00 -07:00
Pranav K 60381c415e Unrendered sections does not throw when redefined and rendered in nested
layout.

Fixes #2252
2015-03-30 09:33:09 -07:00
Ajay Bhargav Baaskaran c62974d39b [Fixes #2179] Validation fix for supporting nested sections in layouts 2015-03-21 17:18:35 -07:00
sornaks c1338a0542 Reacting to Razor changes for removing Generate*() method. 2015-03-17 13:12:38 -07:00
Ajay Bhargav Baaskaran db728cd386 Introducing TempData
- Issue #455
 - Updated MVC sample
 - Added relevant tests
2015-03-10 12:04:05 -07:00
sornaks b581ff343c Making RazorPage.Write() handle TagHelperContent. 2015-03-04 18:26:20 -08:00