Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make offset parent queries less buggy. #14839

Merged
merged 22 commits into from Jan 18, 2017
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
014ad76
Added assertion to process_offset_parent_query
Permutatrix Aug 26, 2016
0a5218d
Fixed ParentOffsetBorderBoxIterator's keeping track of parents
Permutatrix Aug 30, 2016
6623583
offsetParent queries now basically work on inline nodes.
Permutatrix Sep 27, 2016
18793af
Don't crash when offset parent querying an element not in the document
Permutatrix Jan 4, 2017
a61a263
Added tests/wpt/web-platform-tests/cssom-view/offsetPropertiesInline.…
Permutatrix Jan 4, 2017
6a76525
Replaced trivial pattern matching with is_none() and is_some()
Permutatrix Jan 4, 2017
fa0cb7c
Assert self.node_offset_box is None if fragment.node == self.node_add…
Permutatrix Jan 4, 2017
699fc4b
Use InlineFragmentNodeFlags in ParentOffsetBorderBoxIterator
Permutatrix Jan 5, 2017
923ecba
Updated expectations for passing tests
Permutatrix Jan 5, 2017
db5da15
Updated expectations for failing tests that were passing erroneously
Permutatrix Jan 5, 2017
4825169
Split 123-character line
Permutatrix Jan 5, 2017
defa7d9
Actually, node_position probably won't be needed later.
Permutatrix Jan 5, 2017
b75dcc0
Made assertions more helpful
Permutatrix Jan 6, 2017
5be1879
"above the root node" -> "below the root node"
Permutatrix Jan 6, 2017
290ebab
Moved and adjusted offset_properties_inline test
Permutatrix Jan 6, 2017
5ef7a0a
Don't store the offset parent's dimensions
Permutatrix Jan 7, 2017
686d2f8
Don't use rposition() and unwrap() to find parent info
Permutatrix Jan 7, 2017
74e34d6
Handle hypothetical fragments
Permutatrix Jan 13, 2017
cb0d43a
Broke up some comment lines that were a bit too long
Permutatrix Jan 13, 2017
af633b2
Use parent padding box, not border box
Permutatrix Jan 13, 2017
2cd5384
Don't take measurements from non-primary fragments
Permutatrix Jan 13, 2017
400a267
/css-text-3_dev/html/word-break-normal-zh-000.htm fails on Mac
Permutatrix Jan 18, 2017
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Added tests/wpt/web-platform-tests/cssom-view/offsetPropertiesInline.…

…html
  • Loading branch information
Permutatrix committed Jan 13, 2017
commit a61a263291bae9587d8e4395f531e0149a042f7a
"path": "cssom-view/negativeMargins.html",
"url": "/cssom-view/negativeMargins.html"
},
{
"path": "cssom-view/offsetPropertiesInline.html",
"url": "/cssom-view/offsetPropertiesInline.html"
},
{
"path": "cssom-view/scrolling-no-browsing-context.html",
"url": "/cssom-view/scrolling-no-browsing-context.html"
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>cssom-view - offsetParent, offsetTop, offsetLeft, offsetWidth, and offsetHeight on inline elements</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#real-offset-parent {
font: 10px/1 Ahem;
margin: 0;
border: none;
padding: 0;
}
#real-offset-parent, #decoy-offset-parent {
position: relative;
}
</style>
<body>
<div id="real-offset-parent">
<span id="inline-1">ABC</span>
<span id="inline-2">ABC<br />ABC</span>
<span id="inline-3">ABC</span>
</div>
<div id="decoy-offset-parent"></div>

This comment has been minimized.

@emilio

emilio Jan 5, 2017

Member

Is decoy-offset-parent here for some reason? Seems unused. If so, add a comment about it.

Also, don't put this test in the web-platform-tests directory directly (see #12326). Put it under tests/mozilla/css.

<script>
setup({ explicit_done: true });

This comment has been minimized.

@emilio

emilio Jan 5, 2017

Member

instead of explicit_done, you can use:

var t = async_test("...");
window.onload = t.step_func_done(function() {
    // ...
});

but it's fine this way too if you prefer it.

This comment has been minimized.

@jdm

jdm Jan 5, 2017

Member

I'm pretty sure step_func_done doesn't exist and you need t.step_func paired with t.done().

This comment has been minimized.

@emilio

emilio Jan 5, 2017

Member

I'm pretty sure it exists:

$ git grep step_func_done | wc -l                                                                                                                                                            
575

This comment has been minimized.

@Permutatrix

Permutatrix Jan 6, 2017

Author Contributor

@emilio I just did it that way because that's how the other tests in the directory were doing it. I suppose I may as well just do it synchronously.

window.onload = function() {
var realOffsetParent = document.getElementById('real-offset-parent');
var inline1 = document.getElementById('inline-1');
var inline2 = document.getElementById('inline-2');
var inline3 = document.getElementById('inline-3');

test(function() {
assert_equals(inline1.offsetParent, realOffsetParent,
"offsetParent of #inline-1 should be #real-offset-parent.");
assert_equals(inline2.offsetParent, realOffsetParent,
"offsetParent of #inline-2 should be #real-offset-parent.");
assert_equals(inline3.offsetParent, realOffsetParent,
"offsetParent of #inline-3 should be #real-offset-parent.");
}, "offsetParent");

test(function() {
assert_equals(inline1.offsetTop, 0,
"offsetTop of #inline-1 should be 0.");
assert_equals(inline2.offsetTop, 0,
"offsetTop of #inline-2 should be 0.");
assert_equals(inline3.offsetTop, 10,
"offsetTop of #inline-3 should be 10.");
}, "offsetTop");

test(function() {
assert_equals(inline1.offsetLeft, 0,
"offsetLeft of #inline-1 should be 0.");
assert_equals(inline2.offsetLeft, 40,
"offsetLeft of #inline-2 should be 40.");
assert_equals(inline3.offsetLeft, 40,
"offsetLeft of #inline-3 should be 40.");
}, "offsetLeft");

test(function() {
assert_equals(inline1.offsetWidth, 30,
"offsetWidth of #inline-1 should be 30.");
assert_equals(inline2.offsetWidth, 70,
"offsetWidth of #inline-2 should be 70.");
assert_equals(inline3.offsetWidth, 30,
"offsetWidth of #inline-3 should be 30.");
}, "offsetWidth");

test(function() {
assert_equals(inline1.offsetHeight, 10,
"offsetHeight of #inline-1 should be 10.");
assert_equals(inline2.offsetHeight, 20,
"offsetHeight of #inline-2 should be 20.");
assert_equals(inline3.offsetHeight, 10,
"offsetHeight of #inline-3 should be 10.");
}, "offsetHeight");

done();
};
</script>
</body>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.