mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Address review comments
This commit is contained in:
parent
317d2ac547
commit
126938a963
3 changed files with 20 additions and 25 deletions
|
@ -70,6 +70,7 @@ use std::sync::{Arc, Mutex, MutexGuard};
|
|||
use std::thread;
|
||||
use style::computed_values::{filter, mix_blend_mode};
|
||||
use style::media_queries::{MediaType, MediaQueryList, Device};
|
||||
use style::properties::style_structs;
|
||||
use style::selector_matching::Stylist;
|
||||
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
|
||||
use url::Url;
|
||||
|
@ -126,7 +127,7 @@ pub struct LayoutTaskData {
|
|||
/// A queued response for the content boxes of a node.
|
||||
pub content_boxes_response: Vec<Rect<Au>>,
|
||||
|
||||
/// A queued response for the client {top, left, width, height} of a node.
|
||||
/// A queued response for the client {top, left, width, height} of a node in pixels.
|
||||
pub client_rect_response: Rect<i32>,
|
||||
|
||||
/// The list of currently-running animations.
|
||||
|
@ -1436,11 +1437,13 @@ impl FragmentLocatingFragmentIterator {
|
|||
|
||||
impl FragmentBorderBoxIterator for FragmentLocatingFragmentIterator {
|
||||
fn process(&mut self, fragment: &Fragment, border_box: &Rect<Au>) {
|
||||
let border_style_struct = fragment.style.get_border();
|
||||
let top_width = border_style_struct.border_top_width;
|
||||
let right_width = border_style_struct.border_right_width;
|
||||
let bottom_width = border_style_struct.border_bottom_width;
|
||||
let left_width = border_style_struct.border_left_width;
|
||||
let style_structs::Border {
|
||||
border_top_width: top_width,
|
||||
border_right_width: right_width,
|
||||
border_bottom_width: bottom_width,
|
||||
border_left_width: left_width,
|
||||
..
|
||||
} = *fragment.style.get_border();
|
||||
self.client_rect.origin.y = top_width.to_px();
|
||||
self.client_rect.origin.x = left_width.to_px();
|
||||
self.client_rect.size.width = (border_box.size.width - left_width - right_width).to_px();
|
||||
|
|
|
@ -95,7 +95,7 @@ pub trait LayoutRPC {
|
|||
fn content_box(&self) -> ContentBoxResponse;
|
||||
/// Requests the dimensions of all the content boxes, as in the `getClientRects()` call.
|
||||
fn content_boxes(&self) -> ContentBoxesResponse;
|
||||
/// Requests the clientTop.
|
||||
/// Requests the geometry of this node. Used by APIs such as `clientTop`.
|
||||
fn node_geometry(&self) -> NodeGeometryResponse;
|
||||
/// Requests the node containing the point of interest
|
||||
fn hit_test(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()>;
|
||||
|
|
|
@ -76,17 +76,13 @@
|
|||
<div id="with-border">my div</div>
|
||||
<div id="with-border-and-padding">my div</div>
|
||||
<div id="abs1">
|
||||
<div id="abs2">
|
||||
<div id="abs3">
|
||||
<span id="span1">X</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='rotated'>rotated</div>
|
||||
<div id='inline-block'>inline-block</div>
|
||||
<div id='display-none'>display-none</div>
|
||||
<script>
|
||||
test_rect = function(name, left, top, height, width) {
|
||||
function test_rect(name, left, top, height, width) {
|
||||
var div = document.getElementById(name);
|
||||
var rect = div.getBoundingClientRect();
|
||||
|
||||
|
@ -96,18 +92,14 @@
|
|||
assert_equals(div.clientWidth, width);
|
||||
}
|
||||
|
||||
test(function() {
|
||||
test_rect('no-border', 0, 0, 100, 100);
|
||||
test_rect('with-border', 10, 10, 100, 100);
|
||||
test_rect('with-border-and-padding', 10, 10, 120, 120);
|
||||
test_rect('abs1', 0, 0, 120, 100);
|
||||
test_rect('rotated', 0, 0, 100, 100);
|
||||
test_rect('abs2', 0, 0, 80, 80);
|
||||
test_rect('abs3', 0, 0, 40, 48);
|
||||
test_rect('span1', 0, 0, 0, 0);
|
||||
test_rect('inline-block', 0, 0, 100, 100);
|
||||
test_rect('display-none', 0, 0, 0, 0);
|
||||
});
|
||||
test(function() { test_rect('no-border', 0, 0, 100, 100); }, 'Block without border');
|
||||
test(function() { test_rect('with-border', 10, 10, 100, 100); }, 'Block with border');
|
||||
test(function() { test_rect('with-border-and-padding', 10, 10, 120, 120); }, 'Block without border and padding');
|
||||
test(function() { test_rect('abs1', 0, 0, 120, 100); }, 'Absolutely positioned block');
|
||||
test(function() { test_rect('rotated', 0, 0, 100, 100); }, 'Rotated block');
|
||||
test(function() { test_rect('span1', 0, 0, 0, 0); }, 'Span');
|
||||
test(function() { test_rect('inline-block', 0, 0, 100, 100); }, 'Inline block');
|
||||
test(function() { test_rect('display-none', 0, 0, 0, 0); }, 'display: none');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue