happo 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2c89082277fba29525c09cd467d81980fb85e61
4
- data.tar.gz: 13d72d47e69b1183719fd7636fc64b93f58c8396
3
+ metadata.gz: 4b912c9e59c1a784e22ccf182a2cae6e3c33b3d4
4
+ data.tar.gz: fdf5aae7d6c23ac0aa719fd10f3c08b166b231b3
5
5
  SHA512:
6
- metadata.gz: c9ae2ace18a3044f1e02675e1145237ff15cb01cb66de9f2e5d1b0a247b89523b2a3cb1c551e8de04677e0b867c2820f97e6087a2cd60adc8a25f158cc6500c9
7
- data.tar.gz: 7970d125b89ea9ae8c883ceeee1a85cff01850ae0e6ff4a3880b8655dcbf2af86f7ab85659c7e89554e43882f7b42e45ce1000e0a05ab229df240b399b2ad624
6
+ metadata.gz: 727b0821666fa7ee2bf500be9f7a03cb1fa973fa55197ae71df73b8cc22b796abdcec385f0f108d31c76b9642e393474762c4fbe793b4d3a4a47dcffcb10fccb
7
+ data.tar.gz: c0b3764ab83e2872ae99ea45daeaac9d17bd24cef8f8fc3e83dc089647fe5598ec5a1913da390393f4e10ef67c82ce7b903ec9e463b8516cb9fcae94f1c27907
@@ -182,6 +182,16 @@ window.happo = {
182
182
  top: rect.top,
183
183
  };
184
184
 
185
+ // getBoundingClientRect does not include margin, so we need to use
186
+ // getComputedStyle. Since this is slow and the margin of descendent
187
+ // elements is significantly less likely to matter, let's include the margin
188
+ // only from the topmost node.
189
+ var computedStyle = window.getComputedStyle(node);
190
+ box.bottom += parseInt(computedStyle.getPropertyValue('margin-bottom'), 10);
191
+ box.left -= parseInt(computedStyle.getPropertyValue('margin-left'), 10);
192
+ box.right += parseInt(computedStyle.getPropertyValue('margin-right'), 10);
193
+ box.top -= parseInt(computedStyle.getPropertyValue('margin-top'), 10);
194
+
185
195
  // If there are any children, we want to iterate over them recursively,
186
196
  // mutating our box object along the way to expand to include all descendent
187
197
  // nodes.
data/lib/happo/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module Happo
3
- VERSION = '2.1.1'
3
+ VERSION = '2.2.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henric Trotzig
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-09 00:00:00.000000000 Z
12
+ date: 2016-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chunky_png