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



76
77
78
79
80
81
82
83
# File 'lib/webkit_remote_unstable/dom.rb', line 76

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



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

def border
  @border
end

#contentDomQuad (readonly)

Returns the content’s boundary.

Returns:

  • (DomQuad)

    the content’s boundary



64
65
66
# File 'lib/webkit_remote_unstable/dom.rb', line 64

def content
  @content
end

#heightNumber (readonly)

Returns the box’s height.

Returns:

  • (Number)

    the box’s height



69
70
71
# File 'lib/webkit_remote_unstable/dom.rb', line 69

def height
  @height
end

#marginDomQuad (readonly)

Returns the margin’s boundary.

Returns:

  • (DomQuad)

    the margin’s boundary



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

def margin
  @margin
end

#paddingDomQuad (readonly)

Returns the padding’s boundary.

Returns:

  • (DomQuad)

    the padding’s boundary



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

def padding
  @padding
end

#widthNumber (readonly)

Returns the box’s width.

Returns:

  • (Number)

    the box’s width



67
68
69
# File 'lib/webkit_remote_unstable/dom.rb', line 67

def width
  @width
end