Class: WebkitRemote::Client::DomBoxModel

Inherits:
Object
  • Object
show all
Defined in:
lib/webkit_remote_unstable/dom.rb

Overview

Box model layout information for an element.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_box_model) ⇒ DomBoxModel

Wraps raw box model data received via a RPC call.

Parameters:

  • raw_box_model (Hash<Symbol, Object>)

    a BoxModel instance, according to the Webkit remote debugging protocol; this is the return value of a ‘DOM.getBoxModel’ call



68
69
70
71
72
73
74
75
# File 'lib/webkit_remote_unstable/dom.rb', line 68

def initialize(raw_box_model)
  @width = raw_box_model['width']
  @height = raw_box_model['height']
  @margin = WebkitRemote::Client::DomQuad.new raw_box_model['margin']
  @border = WebkitRemote::Client::DomQuad.new raw_box_model['border']
  @padding = WebkitRemote::Client::DomQuad.new raw_box_model['padding']
  @content = WebkitRemote::Client::DomQuad.new raw_box_model['content']
end

Instance Attribute Details

#borderDomQuad (readonly)

Returns the border’s boundary.

Returns:

  • (DomQuad)

    the border’s boundary



52
53
54
# File 'lib/webkit_remote_unstable/dom.rb', line 52

def border
  @border
end

#contentDomQuad (readonly)

Returns the content’s boundary.

Returns:

  • (DomQuad)

    the content’s boundary



56
57
58
# File 'lib/webkit_remote_unstable/dom.rb', line 56

def content
  @content
end

#heightNumber (readonly)

Returns the box’s height.

Returns:

  • (Number)

    the box’s height



61
62
63
# File 'lib/webkit_remote_unstable/dom.rb', line 61

def height
  @height
end

#marginDomQuad (readonly)

Returns the margin’s boundary.

Returns:

  • (DomQuad)

    the margin’s boundary



50
51
52
# File 'lib/webkit_remote_unstable/dom.rb', line 50

def margin
  @margin
end

#paddingDomQuad (readonly)

Returns the padding’s boundary.

Returns:

  • (DomQuad)

    the padding’s boundary



54
55
56
# File 'lib/webkit_remote_unstable/dom.rb', line 54

def padding
  @padding
end

#widthNumber (readonly)

Returns the box’s width.

Returns:

  • (Number)

    the box’s width



59
60
61
# File 'lib/webkit_remote_unstable/dom.rb', line 59

def width
  @width
end