Got rid of the internal copies of webview attributes
Imported from:
abb035a09b
%5E%21/
This commit is contained in:
parent
d7eae69587
commit
2c27b953b5
2 changed files with 75 additions and 91 deletions
|
@ -6,46 +6,52 @@ webViewConstants = require './web-view-constants'
|
||||||
class WebViewAttribute
|
class WebViewAttribute
|
||||||
constructor: (name, webViewImpl) ->
|
constructor: (name, webViewImpl) ->
|
||||||
@name = name
|
@name = name
|
||||||
@value = ''
|
|
||||||
@webViewImpl = webViewImpl
|
@webViewImpl = webViewImpl
|
||||||
|
@ignoreNextMutation = false
|
||||||
|
|
||||||
getValue: -> @value || ''
|
# Retrieves and returns the attribute's value.
|
||||||
|
getValue: -> @webViewImpl.webviewNode.getAttribute(@name) || ''
|
||||||
|
|
||||||
setValue: (value) -> @value = value
|
# Sets the attribute's value.
|
||||||
|
setValue: (value) -> @webViewImpl.webviewNode.setAttribute(@name, value || '')
|
||||||
|
|
||||||
|
# Called when the attribute's value changes.
|
||||||
|
handleMutation: ->
|
||||||
|
|
||||||
|
# Attribute specifying whether transparency is allowed in the webview.
|
||||||
|
class BooleanAttribute extends WebViewAttribute
|
||||||
|
constructor: (name, webViewImpl) ->
|
||||||
|
super name, webViewImpl
|
||||||
|
|
||||||
|
getValue: ->
|
||||||
|
# This attribute is treated as a boolean, and is retrieved as such.
|
||||||
|
@webViewImpl.webviewNode.hasAttribute @name
|
||||||
|
|
||||||
|
setValue: (value) ->
|
||||||
|
unless value
|
||||||
|
@webViewImpl.webviewNode.removeAttribute @name
|
||||||
|
else
|
||||||
|
@webViewImpl.webviewNode.setAttribute @name, ''
|
||||||
|
|
||||||
# Attribute representing the state of the storage partition.
|
# Attribute representing the state of the storage partition.
|
||||||
class Partition extends WebViewAttribute
|
class Partition extends WebViewAttribute
|
||||||
constructor: (webViewImpl) ->
|
constructor: (webViewImpl) ->
|
||||||
super webViewConstants.ATTRIBUTE_PARTITION, webViewImpl
|
super webViewConstants.ATTRIBUTE_PARTITION, webViewImpl
|
||||||
|
|
||||||
@validPartitionId = true
|
@validPartitionId = true
|
||||||
@persistStorage = false
|
|
||||||
@storagePartitionId = ''
|
|
||||||
@webViewImpl = webViewImpl
|
|
||||||
|
|
||||||
getValue: ->
|
handleMutation: (oldValue, newValue) ->
|
||||||
return '' unless @validPartitionId
|
newValue = newValue || ''
|
||||||
(if @persistStorage then 'persist:' else '') + @storagePartitionId
|
|
||||||
|
|
||||||
setValue: (value) ->
|
# The partition cannot change if the webview has already navigated.
|
||||||
result = {}
|
unless @webViewImpl.beforeFirstNavigation
|
||||||
hasNavigated = !@webViewImpl.beforeFirstNavigation
|
window.console.error webViewConstants.ERROR_MSG_ALREADY_NAVIGATED
|
||||||
if hasNavigated
|
@ignoreNextMutation = true
|
||||||
result.error = webViewConstants.ERROR_MSG_ALREADY_NAVIGATED
|
@webViewImpl.webviewNode.setAttribute @name, oldValue
|
||||||
return result
|
return
|
||||||
value = '' unless value
|
|
||||||
LEN = 'persist:'.length
|
if newValue is 'persist:'
|
||||||
if value.substr(0, LEN) == 'persist:'
|
@validPartitionId = false
|
||||||
value = value.substr LEN
|
window.console.error webViewConstants.ERROR_MSG_INVALID_PARTITION_ATTRIBUTE
|
||||||
unless value
|
|
||||||
@validPartitionId = false
|
|
||||||
result.error = webViewConstants.ERROR_MSG_INVALID_PARTITION_ATTRIBUTE
|
|
||||||
return result
|
|
||||||
@persistStorage = true
|
|
||||||
else
|
|
||||||
@persistStorage = false
|
|
||||||
@storagePartitionId = value
|
|
||||||
result
|
|
||||||
|
|
||||||
# Sets up all of the webview attributes.
|
# Sets up all of the webview attributes.
|
||||||
WebView::setupWebViewAttributes = ->
|
WebView::setupWebViewAttributes = ->
|
||||||
|
@ -53,12 +59,14 @@ WebView::setupWebViewAttributes = ->
|
||||||
|
|
||||||
# Initialize the attributes with special behavior (and custom attribute
|
# Initialize the attributes with special behavior (and custom attribute
|
||||||
# objects).
|
# objects).
|
||||||
|
@attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] =
|
||||||
|
new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY, this)
|
||||||
|
@attributes[webViewConstants.ATTRIBUTE_AUTOSIZE] =
|
||||||
|
new BooleanAttribute(webViewConstants.ATTRIBUTE_AUTOSIZE, this)
|
||||||
@attributes[webViewConstants.ATTRIBUTE_PARTITION] = new Partition(this)
|
@attributes[webViewConstants.ATTRIBUTE_PARTITION] = new Partition(this)
|
||||||
|
|
||||||
# Initialize the remaining attributes, which have default behavior.
|
# Initialize the remaining attributes, which have default behavior.
|
||||||
defaultAttributes = [
|
defaultAttributes = [
|
||||||
webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY
|
|
||||||
webViewConstants.ATTRIBUTE_AUTOSIZE
|
|
||||||
webViewConstants.ATTRIBUTE_MAXHEIGHT
|
webViewConstants.ATTRIBUTE_MAXHEIGHT
|
||||||
webViewConstants.ATTRIBUTE_MAXWIDTH
|
webViewConstants.ATTRIBUTE_MAXWIDTH
|
||||||
webViewConstants.ATTRIBUTE_MINHEIGHT
|
webViewConstants.ATTRIBUTE_MINHEIGHT
|
||||||
|
|
|
@ -27,7 +27,6 @@ class WebView
|
||||||
|
|
||||||
@beforeFirstNavigation = true
|
@beforeFirstNavigation = true
|
||||||
@contentWindow = null
|
@contentWindow = null
|
||||||
@validPartitionId = true
|
|
||||||
# Used to save some state upon deferred attachment.
|
# Used to save some state upon deferred attachment.
|
||||||
# If <object> bindings is not available, we defer attachment.
|
# If <object> bindings is not available, we defer attachment.
|
||||||
# This state contains whether or not the attachment request was for
|
# This state contains whether or not the attachment request was for
|
||||||
|
@ -74,7 +73,6 @@ class WebView
|
||||||
guestViewInternal.destroyGuest @guestInstanceId
|
guestViewInternal.destroyGuest @guestInstanceId
|
||||||
@guestInstanceId = undefined
|
@guestInstanceId = undefined
|
||||||
@beforeFirstNavigation = true
|
@beforeFirstNavigation = true
|
||||||
@validPartitionId = true
|
|
||||||
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
|
@attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true
|
||||||
@contentWindow = null
|
@contentWindow = null
|
||||||
@internalInstanceId = 0
|
@internalInstanceId = 0
|
||||||
|
@ -103,10 +101,9 @@ class WebView
|
||||||
|
|
||||||
setupAutoSizeProperties: ->
|
setupAutoSizeProperties: ->
|
||||||
for attributeName in AUTO_SIZE_ATTRIBUTES
|
for attributeName in AUTO_SIZE_ATTRIBUTES
|
||||||
@attributes[attributeName].setValue @webviewNode.getAttribute(attributeName)
|
|
||||||
Object.defineProperty @webviewNode, attributeName,
|
Object.defineProperty @webviewNode, attributeName,
|
||||||
get: => @attributes[attributeName].getValue()
|
get: => @attributes[attributeName].getValue()
|
||||||
set: (value) => @webviewNode.setAttribute attributeName, value
|
set: (value) => @attributes[attributeName].setValue value
|
||||||
enumerable: true
|
enumerable: true
|
||||||
|
|
||||||
setupWebviewNodeProperties: ->
|
setupWebviewNodeProperties: ->
|
||||||
|
@ -114,8 +111,7 @@ class WebView
|
||||||
|
|
||||||
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY,
|
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY,
|
||||||
get: => @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].getValue()
|
get: => @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].getValue()
|
||||||
set: (value) =>
|
set: (value) => @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].setValue value
|
||||||
@webviewNode.setAttribute webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY, value
|
|
||||||
enumerable: true
|
enumerable: true
|
||||||
|
|
||||||
# We cannot use {writable: true} property descriptor because we want a
|
# We cannot use {writable: true} property descriptor because we want a
|
||||||
|
@ -129,22 +125,17 @@ class WebView
|
||||||
|
|
||||||
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_PARTITION,
|
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_PARTITION,
|
||||||
get: => @attributes[webViewConstants.ATTRIBUTE_PARTITION].getValue()
|
get: => @attributes[webViewConstants.ATTRIBUTE_PARTITION].getValue()
|
||||||
set: (value) =>
|
set: (value) => @attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue value
|
||||||
result = @attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue value
|
|
||||||
throw result.error if result.error?
|
|
||||||
@webviewNode.setAttribute webViewConstants.ATTRIBUTE_PARTITION, value
|
|
||||||
enumerable: true
|
enumerable: true
|
||||||
|
|
||||||
@attributes[webViewConstants.ATTRIBUTE_SRC].setValue @webviewNode.getAttribute(webViewConstants.ATTRIBUTE_SRC)
|
|
||||||
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_SRC,
|
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_SRC,
|
||||||
get: => @attributes[webViewConstants.ATTRIBUTE_SRC].getValue()
|
get: => @attributes[webViewConstants.ATTRIBUTE_SRC].getValue()
|
||||||
set: (value) => @webviewNode.setAttribute webViewConstants.ATTRIBUTE_SRC, value
|
set: (value) => @attributes[webViewConstants.ATTRIBUTE_SRC].setValue value
|
||||||
enumerable: true
|
enumerable: true
|
||||||
|
|
||||||
@attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].setValue @webviewNode.getAttribute(webViewConstants.ATTRIBUTE_HTTPREFERRER)
|
|
||||||
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_HTTPREFERRER,
|
Object.defineProperty @webviewNode, webViewConstants.ATTRIBUTE_HTTPREFERRER,
|
||||||
get: => @attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
|
get: => @attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
|
||||||
set: (value) => @webviewNode.setAttribute webViewConstants.ATTRIBUTE_HTTPREFERRER, value
|
set: (value) => @attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].setValue value
|
||||||
enumerable: true
|
enumerable: true
|
||||||
|
|
||||||
# The purpose of this mutation observer is to catch assignment to the src
|
# The purpose of this mutation observer is to catch assignment to the src
|
||||||
|
@ -155,7 +146,7 @@ class WebView
|
||||||
@srcAndPartitionObserver = new MutationObserver (mutations) =>
|
@srcAndPartitionObserver = new MutationObserver (mutations) =>
|
||||||
for mutation in mutations
|
for mutation in mutations
|
||||||
oldValue = mutation.oldValue
|
oldValue = mutation.oldValue
|
||||||
newValue = @webviewNode.getAttribute mutation.attributeName
|
newValue = @attributes[mutation.attributeName].getValue()
|
||||||
return if oldValue isnt newValue
|
return if oldValue isnt newValue
|
||||||
@handleWebviewAttributeMutation mutation.attributeName, oldValue, newValue
|
@handleWebviewAttributeMutation mutation.attributeName, oldValue, newValue
|
||||||
params =
|
params =
|
||||||
|
@ -173,33 +164,33 @@ class WebView
|
||||||
# a BrowserPlugin property will update the corresponding BrowserPlugin
|
# a BrowserPlugin property will update the corresponding BrowserPlugin
|
||||||
# attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
|
# attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
|
||||||
# details.
|
# details.
|
||||||
handleWebviewAttributeMutation: (name, oldValue, newValue) ->
|
handleWebviewAttributeMutation: (attributeName, oldValue, newValue) ->
|
||||||
if name in AUTO_SIZE_ATTRIBUTES
|
# Certain changes (such as internally-initiated changes) to attributes should
|
||||||
@attributes[name].setValue newValue
|
# not be handled normally.
|
||||||
|
if @attributes[attributeName]?.ignoreNextMutation
|
||||||
|
@attributes[attributeName].ignoreNextMutation = false
|
||||||
|
return
|
||||||
|
|
||||||
|
if attributeName in AUTO_SIZE_ATTRIBUTES
|
||||||
return unless @guestInstanceId
|
return unless @guestInstanceId
|
||||||
# Convert autosize attribute to boolean.
|
|
||||||
autosize = @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_AUTOSIZE
|
|
||||||
guestViewInternal.setAutoSize @guestInstanceId,
|
guestViewInternal.setAutoSize @guestInstanceId,
|
||||||
enableAutoSize: autosize,
|
enableAutoSize: @attributes[webViewConstants.ATTRIBUTE_AUTOSIZE].getValue(),
|
||||||
min:
|
min:
|
||||||
width: parseInt @attributes[webViewConstants.ATTRIBUTE_MINWIDTH].getValue() || 0
|
width: parseInt @attributes[webViewConstants.ATTRIBUTE_MINWIDTH].getValue() || 0
|
||||||
height: parseInt @attributes[webViewConstants.ATTRIBUTE_MINHEIGHT].getValue() || 0
|
height: parseInt @attributes[webViewConstants.ATTRIBUTE_MINHEIGHT].getValue() || 0
|
||||||
max:
|
max:
|
||||||
width: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXWIDTH].getValue() || 0
|
width: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXWIDTH].getValue() || 0
|
||||||
height: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXHEIGHT].getValue() || 0
|
height: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXHEIGHT].getValue() || 0
|
||||||
else if name is webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY
|
else if attributeName is webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY
|
||||||
# We treat null attribute (attribute removed) and the empty string as
|
# We treat null attribute (attribute removed) and the empty string as
|
||||||
# one case.
|
# one case.
|
||||||
oldValue ?= ''
|
oldValue ?= ''
|
||||||
newValue ?= ''
|
newValue ?= ''
|
||||||
|
|
||||||
return if oldValue is newValue
|
return if oldValue is newValue and not @guestInstanceId
|
||||||
@attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].setValue(newValue != '')
|
|
||||||
|
|
||||||
return unless @guestInstanceId
|
|
||||||
|
|
||||||
guestViewInternal.setAllowTransparency @guestInstanceId, @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].getValue()
|
guestViewInternal.setAllowTransparency @guestInstanceId, @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].getValue()
|
||||||
else if name is webViewConstants.ATTRIBUTE_HTTPREFERRER
|
else if attributeName is webViewConstants.ATTRIBUTE_HTTPREFERRER
|
||||||
oldValue ?= ''
|
oldValue ?= ''
|
||||||
newValue ?= ''
|
newValue ?= ''
|
||||||
|
|
||||||
|
@ -208,19 +199,16 @@ class WebView
|
||||||
|
|
||||||
@attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].setValue newValue
|
@attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].setValue newValue
|
||||||
|
|
||||||
result = {}
|
|
||||||
# If the httpreferrer changes treat it as though the src changes and reload
|
# If the httpreferrer changes treat it as though the src changes and reload
|
||||||
# the page with the new httpreferrer.
|
# the page with the new httpreferrer.
|
||||||
@parseSrcAttribute result
|
@parseSrcAttribute()
|
||||||
|
else if attributeName is webViewConstants.ATTRIBUTE_SRC
|
||||||
throw result.error if result.error?
|
|
||||||
else if name is webViewConstants.ATTRIBUTE_SRC
|
|
||||||
# We treat null attribute (attribute removed) and the empty string as
|
# We treat null attribute (attribute removed) and the empty string as
|
||||||
# one case.
|
# one case.
|
||||||
oldValue ?= ''
|
oldValue ?= ''
|
||||||
newValue ?= ''
|
newValue ?= ''
|
||||||
# Once we have navigated, we don't allow clearing the src attribute.
|
# Once we have navigated, we don't allow clearing the src attribute.
|
||||||
# Once <webview> enters a navigated state, it cannot be return back to a
|
# Once <webview> enters a navigated state, it cannot return to a
|
||||||
# placeholder state.
|
# placeholder state.
|
||||||
if newValue == '' and oldValue != ''
|
if newValue == '' and oldValue != ''
|
||||||
# src attribute changes normally initiate a navigation. We suppress
|
# src attribute changes normally initiate a navigation. We suppress
|
||||||
|
@ -228,22 +216,19 @@ class WebView
|
||||||
# on every guest-initiated navigation.
|
# on every guest-initiated navigation.
|
||||||
@ignoreNextSrcAttributeChange = true
|
@ignoreNextSrcAttributeChange = true
|
||||||
@webviewNode.setAttribute webViewConstants.ATTRIBUTE_SRC, oldValue
|
@webviewNode.setAttribute webViewConstants.ATTRIBUTE_SRC, oldValue
|
||||||
@src = newValue
|
return
|
||||||
|
|
||||||
if @ignoreNextSrcAttributeChange
|
if @ignoreNextSrcAttributeChange
|
||||||
# Don't allow the src mutation observer to see this change.
|
# Don't allow the src mutation observer to see this change.
|
||||||
@srcAndPartitionObserver.takeRecords()
|
@srcAndPartitionObserver.takeRecords()
|
||||||
@ignoreNextSrcAttributeChange = false
|
@ignoreNextSrcAttributeChange = false
|
||||||
return
|
return
|
||||||
result = {}
|
@parseSrcAttribute()
|
||||||
@parseSrcAttribute result
|
else if attributeName is webViewConstants.ATTRIBUTE_PARTITION
|
||||||
|
@attributes[webViewConstants.ATTRIBUTE_PARTITION].handleMutation oldValue, newValue
|
||||||
|
|
||||||
throw result.error if result.error?
|
handleBrowserPluginAttributeMutation: (attributeName, oldValue, newValue) ->
|
||||||
else if name is webViewConstants.ATTRIBUTE_PARTITION
|
if attributeName is webViewConstants.ATTRIBUTE_INTERNALINSTANCEID and !oldValue and !!newValue
|
||||||
# Note that throwing error here won't synchronously propagate.
|
|
||||||
@attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue newValue
|
|
||||||
|
|
||||||
handleBrowserPluginAttributeMutation: (name, oldValue, newValue) ->
|
|
||||||
if name is webViewConstants.ATTRIBUTE_INTERNALINSTANCEID and !oldValue and !!newValue
|
|
||||||
@browserPluginNode.removeAttribute webViewConstants.ATTRIBUTE_INTERNALINSTANCEID
|
@browserPluginNode.removeAttribute webViewConstants.ATTRIBUTE_INTERNALINSTANCEID
|
||||||
@internalInstanceId = parseInt newValue
|
@internalInstanceId = parseInt newValue
|
||||||
|
|
||||||
|
@ -289,7 +274,7 @@ class WebView
|
||||||
minHeight = height
|
minHeight = height
|
||||||
minHeight = maxHeight if minHeight > maxHeight
|
minHeight = maxHeight if minHeight > maxHeight
|
||||||
|
|
||||||
if not @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_AUTOSIZE or
|
if not @attributes[webViewConstants.ATTRIBUTE_AUTOSIZE].getValue() or
|
||||||
(newWidth >= minWidth and
|
(newWidth >= minWidth and
|
||||||
newWidth <= maxWidth and
|
newWidth <= maxWidth and
|
||||||
newHeight >= minHeight and
|
newHeight >= minHeight and
|
||||||
|
@ -307,13 +292,10 @@ class WebView
|
||||||
hasNavigated: ->
|
hasNavigated: ->
|
||||||
not @beforeFirstNavigation
|
not @beforeFirstNavigation
|
||||||
|
|
||||||
parseSrcAttribute: (result) ->
|
parseSrcAttribute: ->
|
||||||
unless @attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId
|
if not @attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId or
|
||||||
result.error = webViewConstants.ERROR_MSG_INVALID_PARTITION_ATTRIBUTE
|
not @attributes[webViewConstants.ATTRIBUTE_SRC].getValue()
|
||||||
return
|
return
|
||||||
@attributes[webViewConstants.ATTRIBUTE_SRC].setValue @webviewNode.getAttribute(webViewConstants.ATTRIBUTE_SRC)
|
|
||||||
|
|
||||||
return unless @attributes[webViewConstants.ATTRIBUTE_SRC].getValue()
|
|
||||||
|
|
||||||
unless @guestInstanceId?
|
unless @guestInstanceId?
|
||||||
if @beforeFirstNavigation
|
if @beforeFirstNavigation
|
||||||
|
@ -329,17 +311,12 @@ class WebView
|
||||||
parseAttributes: ->
|
parseAttributes: ->
|
||||||
return unless @elementAttached
|
return unless @elementAttached
|
||||||
hasNavigated = @hasNavigated()
|
hasNavigated = @hasNavigated()
|
||||||
attributeValue = @webviewNode.getAttribute webViewConstants.ATTRIBUTE_PARTITION
|
@parseSrcAttribute()
|
||||||
result = @attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue attributeValue
|
|
||||||
@parseSrcAttribute result
|
|
||||||
|
|
||||||
createGuest: ->
|
createGuest: ->
|
||||||
return if @pendingGuestCreation
|
return if @pendingGuestCreation
|
||||||
storagePartitionId =
|
|
||||||
@webviewNode.getAttribute(webViewConstants.ATTRIBUTE_PARTITION) or
|
|
||||||
@webviewNode[webViewConstants.ATTRIBUTE_PARTITION]
|
|
||||||
params =
|
params =
|
||||||
storagePartitionId: storagePartitionId
|
storagePartitionId: @attributes[webViewConstants.ATTRIBUTE_PARTITION].getValue()
|
||||||
nodeIntegration: @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_NODEINTEGRATION
|
nodeIntegration: @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_NODEINTEGRATION
|
||||||
plugins: @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_PLUGINS
|
plugins: @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_PLUGINS
|
||||||
if @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_PRELOAD
|
if @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_PRELOAD
|
||||||
|
@ -390,12 +367,11 @@ class WebView
|
||||||
this.webviewNode.setAttribute webViewConstants.ATTRIBUTE_SRC, newValue
|
this.webviewNode.setAttribute webViewConstants.ATTRIBUTE_SRC, newValue
|
||||||
|
|
||||||
onAttach: (storagePartitionId) ->
|
onAttach: (storagePartitionId) ->
|
||||||
@webviewNode.setAttribute webViewConstants.ATTRIBUTE_PARTITION, storagePartitionId
|
|
||||||
@attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue storagePartitionId
|
@attributes[webViewConstants.ATTRIBUTE_PARTITION].setValue storagePartitionId
|
||||||
|
|
||||||
buildAttachParams: (isNewWindow) ->
|
buildAttachParams: (isNewWindow) ->
|
||||||
allowtransparency: @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].getValue() || false
|
allowtransparency: @attributes[webViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY].getValue()
|
||||||
autosize: @webviewNode.hasAttribute webViewConstants.ATTRIBUTE_AUTOSIZE
|
autosize: @attributes[webViewConstants.ATTRIBUTE_AUTOSIZE].getValue()
|
||||||
instanceId: @viewInstanceId
|
instanceId: @viewInstanceId
|
||||||
maxheight: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXHEIGHT].getValue() || 0
|
maxheight: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXHEIGHT].getValue() || 0
|
||||||
maxwidth: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXWIDTH].getValue() || 0
|
maxwidth: parseInt @attributes[webViewConstants.ATTRIBUTE_MAXWIDTH].getValue() || 0
|
||||||
|
|
Loading…
Reference in a new issue