mirror of
https://github.com/servo/servo.git
synced 2025-06-18 05:14:28 +00:00
Merge remote-tracking branch 'origin/master' into HEAD
Conflicts: src/components/script/dom/bindings/proxyhandler.rs src/components/script/dom/bindings/text.rs
This commit is contained in:
commit
9624148f18
58 changed files with 2099 additions and 862 deletions
19
README.md
19
README.md
|
@ -26,6 +26,15 @@ sudo apt-get install autoconf2.13 curl freeglut3-dev libtool \
|
||||||
xorg-dev msttcorefonts
|
xorg-dev msttcorefonts
|
||||||
```
|
```
|
||||||
|
|
||||||
|
On Debian-based Linuxes (cross-compilation for Android):
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
sudo apt-get install autoconf2.13 curl libtool ia32-libs
|
||||||
|
```
|
||||||
|
And it needs pre-installed Android tools.
|
||||||
|
See wiki for [details](https://github.com/mozilla/servo/wiki/Doc-building-for-android)
|
||||||
|
|
||||||
|
|
||||||
Servo builds its own copy of Rust, so there is no need to provide a Rust
|
Servo builds its own copy of Rust, so there is no need to provide a Rust
|
||||||
compiler.
|
compiler.
|
||||||
|
|
||||||
|
@ -43,6 +52,16 @@ make && make check
|
||||||
./servo ../src/test/html/about-mozilla.html
|
./servo ../src/test/html/about-mozilla.html
|
||||||
```
|
```
|
||||||
|
|
||||||
|
###Building for Android target
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
git clone https://github.com/mozilla/servo.git
|
||||||
|
cd servo
|
||||||
|
mkdir -p build && cd build
|
||||||
|
../configure --target-triples=arm-linux-androideabi --android-cross-path=<Android toolchain path> --android-ndk-path=<Android NDK path> --android-sdk-path=<Android SDK path>
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
### Commandline Arguments
|
### Commandline Arguments
|
||||||
|
|
|
@ -48,3 +48,4 @@ clean-script:
|
||||||
clean-servo: clean-gfx clean-util clean-net clean-script clean-msg
|
clean-servo: clean-gfx clean-util clean-net clean-script clean-msg
|
||||||
@$(call E, "cleaning servo")
|
@$(call E, "cleaning servo")
|
||||||
$(Q)rm -f servo servo-test libservo*.so
|
$(Q)rm -f servo servo-test libservo*.so
|
||||||
|
$(Q)cd $(BINDINGS_SRC) && rm -f *.pkl
|
||||||
|
|
|
@ -47,6 +47,8 @@ pub struct CompositorLayer {
|
||||||
/// A monotonically increasing counter that keeps track of the current epoch.
|
/// A monotonically increasing counter that keeps track of the current epoch.
|
||||||
/// add_buffer() calls that don't match the current epoch will be ignored.
|
/// add_buffer() calls that don't match the current epoch will be ignored.
|
||||||
epoch: Epoch,
|
epoch: Epoch,
|
||||||
|
/// The behavior of this layer when a scroll message is received.
|
||||||
|
scroll_behavior: ScrollBehavior,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper struct for keeping CompositorLayer children organized.
|
/// Helper struct for keeping CompositorLayer children organized.
|
||||||
|
@ -65,6 +67,16 @@ enum MaybeQuadtree {
|
||||||
NoTree(uint, Option<uint>),
|
NoTree(uint, Option<uint>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Determines the behavior of the layer when a scroll message is recieved.
|
||||||
|
enum ScrollBehavior {
|
||||||
|
/// Normal scrolling behavior.
|
||||||
|
Scroll,
|
||||||
|
/// Scrolling messages targeted at this layer are ignored, but can be
|
||||||
|
/// passed on to child layers.
|
||||||
|
FixedPosition,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
impl CompositorLayer {
|
impl CompositorLayer {
|
||||||
/// Creates a new CompositorLayer with an optional page size. If no page size is given,
|
/// Creates a new CompositorLayer with an optional page size. If no page size is given,
|
||||||
/// the layer is initially hidden and initialized without a quadtree.
|
/// the layer is initially hidden and initialized without a quadtree.
|
||||||
|
@ -85,6 +97,7 @@ impl CompositorLayer {
|
||||||
root_layer: @mut ContainerLayer(),
|
root_layer: @mut ContainerLayer(),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
epoch: Epoch(0),
|
epoch: Epoch(0),
|
||||||
|
scroll_behavior: Scroll,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +154,9 @@ impl CompositorLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This scroll event is mine!
|
||||||
|
match self.scroll_behavior {
|
||||||
|
Scroll => {
|
||||||
// Scroll this layer!
|
// Scroll this layer!
|
||||||
let old_origin = self.scroll_offset;
|
let old_origin = self.scroll_offset;
|
||||||
self.scroll_offset = self.scroll_offset + delta;
|
self.scroll_offset = self.scroll_offset + delta;
|
||||||
|
@ -165,6 +181,9 @@ impl CompositorLayer {
|
||||||
0.0));
|
0.0));
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
FixedPosition => false, // Ignore this scroll event.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Takes in a MouseWindowEvent, determines if it should be passed to children, and
|
// Takes in a MouseWindowEvent, determines if it should be passed to children, and
|
||||||
// sends the event off to the appropriate pipeline. NB: the cursor position is in
|
// sends the event off to the appropriate pipeline. NB: the cursor position is in
|
||||||
|
|
|
@ -67,6 +67,10 @@ impl ScriptListener for CompositorChan {
|
||||||
self.chan.send(InvalidateRect(id, rect));
|
self.chan.send(InvalidateRect(id, rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn close(&self) {
|
||||||
|
self.chan.send(Exit);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of the abstract `RenderListener` interface.
|
/// Implementation of the abstract `RenderListener` interface.
|
||||||
|
|
|
@ -30,7 +30,7 @@ use newcss::units::{Cursive, Fantasy, Monospace, SansSerif, Serif};
|
||||||
use newcss::values::{CSSClearNone, CSSClearLeft, CSSClearRight, CSSClearBoth};
|
use newcss::values::{CSSClearNone, CSSClearLeft, CSSClearRight, CSSClearBoth};
|
||||||
use newcss::values::{CSSFontFamilyFamilyName, CSSFontFamilyGenericFamily};
|
use newcss::values::{CSSFontFamilyFamilyName, CSSFontFamilyGenericFamily};
|
||||||
use newcss::values::{CSSFontSizeLength, CSSFontStyleItalic, CSSFontStyleNormal};
|
use newcss::values::{CSSFontSizeLength, CSSFontStyleItalic, CSSFontStyleNormal};
|
||||||
use newcss::values::{CSSFontStyleOblique, CSSTextAlign, CSSTextDecoration, CSSLineHeight};
|
use newcss::values::{CSSFontStyleOblique, CSSTextAlign, CSSTextDecoration, CSSLineHeight, CSSVerticalAlign};
|
||||||
use newcss::values::{CSSTextDecorationNone, CSSFloatNone, CSSPositionStatic};
|
use newcss::values::{CSSTextDecorationNone, CSSFloatNone, CSSPositionStatic};
|
||||||
use newcss::values::{CSSDisplayInlineBlock, CSSDisplayInlineTable};
|
use newcss::values::{CSSDisplayInlineBlock, CSSDisplayInlineTable};
|
||||||
use script::dom::node::{AbstractNode, LayoutView};
|
use script::dom::node::{AbstractNode, LayoutView};
|
||||||
|
@ -817,6 +817,10 @@ impl RenderBox {
|
||||||
self.nearest_ancestor_element().style().line_height()
|
self.nearest_ancestor_element().style().line_height()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn vertical_align(&self) -> CSSVerticalAlign {
|
||||||
|
self.nearest_ancestor_element().style().vertical_align()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the text decoration of the computed style of the nearest `Element` node
|
/// Returns the text decoration of the computed style of the nearest `Element` node
|
||||||
pub fn text_decoration(&self) -> CSSTextDecoration {
|
pub fn text_decoration(&self) -> CSSTextDecoration {
|
||||||
/// Computes the propagated value of text-decoration, as specified in CSS 2.1 § 16.3.1
|
/// Computes the propagated value of text-decoration, as specified in CSS 2.1 § 16.3.1
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use css::node_style::StyledNode;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use layout::box::{CannotSplit, GenericRenderBoxClass, ImageRenderBoxClass, RenderBox};
|
use layout::box::{CannotSplit, GenericRenderBoxClass, ImageRenderBoxClass, RenderBox};
|
||||||
use layout::box::{SplitDidFit, SplitDidNotFit, TextRenderBoxClass};
|
use layout::box::{SplitDidFit, SplitDidNotFit, TextRenderBoxClass};
|
||||||
|
@ -17,9 +18,13 @@ use std::util;
|
||||||
use geom::{Point2D, Rect, Size2D};
|
use geom::{Point2D, Rect, Size2D};
|
||||||
use gfx::display_list::DisplayList;
|
use gfx::display_list::DisplayList;
|
||||||
use gfx::geometry::Au;
|
use gfx::geometry::Au;
|
||||||
use newcss::values::{CSSTextAlignLeft, CSSTextAlignCenter, CSSTextAlignRight, CSSTextAlignJustify};
|
|
||||||
use newcss::units::{Em, Px};
|
use newcss::units::{Em, Px};
|
||||||
|
use newcss::values::{CSSFontSizeLength};
|
||||||
|
use newcss::values::{CSSTextAlignLeft, CSSTextAlignCenter, CSSTextAlignRight, CSSTextAlignJustify};
|
||||||
use newcss::values::{CSSLineHeightNormal, CSSLineHeightNumber, CSSLineHeightLength, CSSLineHeightPercentage};
|
use newcss::values::{CSSLineHeightNormal, CSSLineHeightNumber, CSSLineHeightLength, CSSLineHeightPercentage};
|
||||||
|
use newcss::values::{CSSVerticalAlignBaseline, CSSVerticalAlignMiddle, CSSVerticalAlignSub, CSSVerticalAlignSuper,
|
||||||
|
CSSVerticalAlignTextTop, CSSVerticalAlignTextBottom, CSSVerticalAlignTop, CSSVerticalAlignBottom,
|
||||||
|
CSSVerticalAlignLength, CSSVerticalAlignPercentage};
|
||||||
use servo_util::range::Range;
|
use servo_util::range::Range;
|
||||||
use servo_util::tree::TreeNodeRef;
|
use servo_util::tree::TreeNodeRef;
|
||||||
use extra::container::Deque;
|
use extra::container::Deque;
|
||||||
|
@ -164,6 +169,16 @@ impl LineboxScanner {
|
||||||
self.reset_linebox();
|
self.reset_linebox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn calculate_line_height(&self, box: RenderBox, font_size: Au) -> Au {
|
||||||
|
match box.line_height() {
|
||||||
|
CSSLineHeightNormal => font_size.scale_by(1.14f),
|
||||||
|
CSSLineHeightNumber(l) => font_size.scale_by(l),
|
||||||
|
CSSLineHeightLength(Em(l)) => font_size.scale_by(l),
|
||||||
|
CSSLineHeightLength(Px(l)) => Au::from_frac_px(l),
|
||||||
|
CSSLineHeightPercentage(p) => font_size.scale_by(p / 100.0f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn box_height(&self, box: RenderBox) -> Au {
|
fn box_height(&self, box: RenderBox) -> Au {
|
||||||
match box {
|
match box {
|
||||||
ImageRenderBoxClass(image_box) => {
|
ImageRenderBoxClass(image_box) => {
|
||||||
|
@ -180,13 +195,7 @@ impl LineboxScanner {
|
||||||
// Compute the height based on the line-height and font size
|
// Compute the height based on the line-height and font size
|
||||||
let text_bounds = run.metrics_for_range(range).bounding_box;
|
let text_bounds = run.metrics_for_range(range).bounding_box;
|
||||||
let em_size = text_bounds.size.height;
|
let em_size = text_bounds.size.height;
|
||||||
let line_height = match box.line_height() {
|
let line_height = self.calculate_line_height(box, em_size);
|
||||||
CSSLineHeightNormal => em_size.scale_by(1.14f),
|
|
||||||
CSSLineHeightNumber(l) => em_size.scale_by(l),
|
|
||||||
CSSLineHeightLength(Em(l)) => em_size.scale_by(l),
|
|
||||||
CSSLineHeightLength(Px(l)) => Au::from_frac_px(l),
|
|
||||||
CSSLineHeightPercentage(p) => em_size.scale_by(p / 100.0f)
|
|
||||||
};
|
|
||||||
|
|
||||||
line_height
|
line_height
|
||||||
}
|
}
|
||||||
|
@ -600,8 +609,10 @@ impl InlineFlowData {
|
||||||
let mut scanner = LineboxScanner::new(scanner_floats);
|
let mut scanner = LineboxScanner::new(scanner_floats);
|
||||||
scanner.scan_for_lines(self);
|
scanner.scan_for_lines(self);
|
||||||
|
|
||||||
|
let mut line_height_offset = Au(0);
|
||||||
|
|
||||||
// Now, go through each line and lay out the boxes inside
|
// Now, go through each line and lay out the boxes inside
|
||||||
for line in self.lines.iter() {
|
for line in self.lines.mut_iter() {
|
||||||
// We need to distribute extra width based on text-align.
|
// We need to distribute extra width based on text-align.
|
||||||
let mut slack_width = line.green_zone.width - line.bounds.size.width;
|
let mut slack_width = line.green_zone.width - line.bounds.size.width;
|
||||||
if slack_width < Au(0) {
|
if slack_width < Au(0) {
|
||||||
|
@ -654,80 +665,224 @@ impl InlineFlowData {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Set the top y position of the current linebox.
|
||||||
|
// `line_height_offset` is updated at the end of the previous loop.
|
||||||
|
line.bounds.origin.y = line.bounds.origin.y + line_height_offset;
|
||||||
|
|
||||||
|
// Calculate the distance from baseline to the top of the linebox.
|
||||||
|
let mut topmost = Au(0);
|
||||||
|
// Calculate the distance from baseline to the bottom of the linebox.
|
||||||
|
let mut bottommost = Au(0);
|
||||||
|
|
||||||
|
// Calculate the biggest height among boxes with 'top' value.
|
||||||
|
let mut biggest_top = Au(0);
|
||||||
|
// Calculate the biggest height among boxes with 'bottom' value.
|
||||||
|
let mut biggest_bottom = Au(0);
|
||||||
|
|
||||||
// Get the baseline offset, assuming that the tallest text box will determine
|
|
||||||
// the baseline.
|
|
||||||
let mut baseline_offset = Au(0);
|
|
||||||
let mut max_height = Au(0);
|
|
||||||
for box_i in line.range.eachi() {
|
for box_i in line.range.eachi() {
|
||||||
let cur_box = self.boxes[box_i];
|
let cur_box = self.boxes[box_i];
|
||||||
|
|
||||||
match cur_box {
|
let (top_from_base, bottom_from_base, ascent) = match cur_box {
|
||||||
ImageRenderBoxClass(image_box) => {
|
ImageRenderBoxClass(image_box) => {
|
||||||
let size = image_box.image.get_size();
|
let size = image_box.image.get_size();
|
||||||
let height = Au::from_px(size.unwrap_or_default(Size2D(0, 0)).height);
|
let mut height = Au::from_px(size.unwrap_or_default(Size2D(0, 0)).height);
|
||||||
image_box.base.position.size.height = height;
|
|
||||||
|
|
||||||
image_box.base.position.translate(&Point2D(Au(0), -height))
|
// TODO: margin, border, padding's top and bottom should be calculated in advance,
|
||||||
|
// since baseline of image is bottom margin edge.
|
||||||
|
let mut top = Au(0);
|
||||||
|
let mut bottom = Au(0);
|
||||||
|
do cur_box.with_model |model| {
|
||||||
|
top = model.border.top + model.padding.top + model.margin.top;
|
||||||
|
bottom = model.border.bottom + model.padding.bottom + model.margin.bottom;
|
||||||
}
|
}
|
||||||
TextRenderBoxClass(text_box) => {
|
let noncontent_height = top + bottom;
|
||||||
|
height = height + noncontent_height;
|
||||||
|
image_box.base.position.size.height = height;
|
||||||
|
image_box.base.position.translate(&Point2D(Au(0), -height));
|
||||||
|
|
||||||
|
let ascent = height + bottom;
|
||||||
|
(height, Au(0), ascent)
|
||||||
|
},
|
||||||
|
TextRenderBoxClass(text_box) => {
|
||||||
let range = &text_box.range;
|
let range = &text_box.range;
|
||||||
let run = &text_box.run;
|
let run = &text_box.run;
|
||||||
|
|
||||||
// Compute the height based on the line-height and font size
|
// Compute the height based on the line-height and font size
|
||||||
let text_bounds = run.metrics_for_range(range).bounding_box;
|
let text_bounds = run.metrics_for_range(range).bounding_box;
|
||||||
let em_size = text_bounds.size.height;
|
let em_size = text_bounds.size.height;
|
||||||
let line_height = match cur_box.line_height() {
|
let line_height = scanner.calculate_line_height(cur_box, em_size);
|
||||||
CSSLineHeightNormal => em_size.scale_by(1.14f),
|
|
||||||
CSSLineHeightNumber(l) => em_size.scale_by(l),
|
|
||||||
CSSLineHeightLength(Em(l)) => em_size.scale_by(l),
|
|
||||||
CSSLineHeightLength(Px(l)) => Au::from_frac_px(l),
|
|
||||||
CSSLineHeightPercentage(p) => em_size.scale_by(p / 100.0f)
|
|
||||||
};
|
|
||||||
|
|
||||||
// If this is the current tallest box then use it for baseline
|
// Find the top and bottom of the content area.
|
||||||
// calculations.
|
// Those are used in text-top and text-bottom value of 'vertical-align'
|
||||||
// TODO: this will need to take into account type of line-height
|
let text_ascent = text_box.run.font.metrics.ascent;
|
||||||
// and the vertical-align value.
|
|
||||||
if line_height > max_height {
|
// Offset from the top of the box is 1/2 of the leading + ascent
|
||||||
max_height = line_height;
|
let text_offset = text_ascent + (line_height - em_size).scale_by(0.5f);
|
||||||
let linebox_height = line.bounds.size.height;
|
text_bounds.translate(&Point2D(text_box.base.position.origin.x, Au(0)));
|
||||||
// Offset from the top of the linebox is 1/2 of the leading + ascent
|
|
||||||
baseline_offset = text_box.run.font.metrics.ascent +
|
(text_offset, line_height - text_offset, text_ascent)
|
||||||
(linebox_height - em_size).scale_by(0.5f);
|
},
|
||||||
}
|
|
||||||
text_bounds.translate(&Point2D(text_box.base.position.origin.x, Au(0)))
|
|
||||||
}
|
|
||||||
GenericRenderBoxClass(generic_box) => {
|
GenericRenderBoxClass(generic_box) => {
|
||||||
generic_box.position
|
(generic_box.position.size.height, Au(0), generic_box.position.size.height)
|
||||||
}
|
},
|
||||||
// FIXME(pcwalton): This isn't very type safe!
|
// FIXME(pcwalton): This isn't very type safe!
|
||||||
_ => {
|
_ => {
|
||||||
fail!(fmt!("Tried to assign height to unknown Box variant: %s",
|
fail!(fmt!("Tried to assign height to unknown Box variant: %s",
|
||||||
cur_box.debug_str()))
|
cur_box.debug_str()))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let mut top_from_base = top_from_base;
|
||||||
|
let mut bottom_from_base = bottom_from_base;
|
||||||
|
|
||||||
|
// To calculate text-top and text-bottom value of 'vertical-align',
|
||||||
|
// we should find the top and bottom of the content area of parent box.
|
||||||
|
// The content area is defined in "http://www.w3.org/TR/CSS2/visudet.html#inline-non-replaced".
|
||||||
|
// TODO: We should extract em-box info from font size of parent
|
||||||
|
// and calcuate the distances from baseline to the top and the bottom of parent's content area.
|
||||||
|
|
||||||
|
// It should calculate the distance from baseline to the top of parent's content area.
|
||||||
|
// But, it is assumed now as font size of parent.
|
||||||
|
let mut parent_text_top = Au(0);
|
||||||
|
// It should calculate the distance from baseline to the bottom of parent's content area.
|
||||||
|
// But, it is assumed now as 0.
|
||||||
|
let parent_text_bottom = Au(0);
|
||||||
|
do cur_box.with_mut_base |base| {
|
||||||
|
// Get parent node
|
||||||
|
let parent = base.node.parent_node().map_default(base.node, |parent| *parent);
|
||||||
|
// TODO: When the calculation of font-size style is supported, it should be updated.
|
||||||
|
let font_size = match parent.style().font_size() {
|
||||||
|
CSSFontSizeLength(Px(length)) => length,
|
||||||
|
// todo: this is based on a hard coded font size, should be the parent element's font size
|
||||||
|
CSSFontSizeLength(Em(length)) => length * 16f,
|
||||||
|
_ => 16f // px units
|
||||||
|
};
|
||||||
|
parent_text_top = Au::from_frac_px(font_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now go back and adjust the Y coordinates to match the baseline we determined.
|
// This flag decides whether topmost and bottommost are updated or not.
|
||||||
|
// That is, if the box has top or bottom value, no_update_flag becomes true.
|
||||||
|
let mut no_update_flag = false;
|
||||||
|
// Calculate a relative offset from baseline.
|
||||||
|
let offset = match cur_box.vertical_align() {
|
||||||
|
CSSVerticalAlignBaseline => {
|
||||||
|
-ascent
|
||||||
|
},
|
||||||
|
CSSVerticalAlignMiddle => {
|
||||||
|
// TODO: x-height value should be used from font info.
|
||||||
|
let xheight = Au(0);
|
||||||
|
-(xheight + scanner.box_height(cur_box)).scale_by(0.5)
|
||||||
|
},
|
||||||
|
CSSVerticalAlignSub => {
|
||||||
|
// TODO: The proper position for subscripts should be used.
|
||||||
|
// Lower the baseline to the proper position for subscripts
|
||||||
|
let sub_offset = Au(0);
|
||||||
|
(sub_offset - ascent)
|
||||||
|
},
|
||||||
|
CSSVerticalAlignSuper => {
|
||||||
|
// TODO: The proper position for superscripts should be used.
|
||||||
|
// Raise the baseline to the proper position for superscripts
|
||||||
|
let super_offset = Au(0);
|
||||||
|
(-super_offset - ascent)
|
||||||
|
},
|
||||||
|
CSSVerticalAlignTextTop => {
|
||||||
|
let box_height = top_from_base + bottom_from_base;
|
||||||
|
let prev_bottom_from_base = bottom_from_base;
|
||||||
|
top_from_base = parent_text_top;
|
||||||
|
bottom_from_base = box_height - top_from_base;
|
||||||
|
(bottom_from_base - prev_bottom_from_base - ascent)
|
||||||
|
},
|
||||||
|
CSSVerticalAlignTextBottom => {
|
||||||
|
let box_height = top_from_base + bottom_from_base;
|
||||||
|
let prev_bottom_from_base = bottom_from_base;
|
||||||
|
bottom_from_base = parent_text_bottom;
|
||||||
|
top_from_base = box_height - bottom_from_base;
|
||||||
|
(bottom_from_base - prev_bottom_from_base - ascent)
|
||||||
|
},
|
||||||
|
CSSVerticalAlignTop => {
|
||||||
|
if biggest_top < (top_from_base + bottom_from_base) {
|
||||||
|
biggest_top = top_from_base + bottom_from_base;
|
||||||
|
}
|
||||||
|
let offset_top = top_from_base - ascent;
|
||||||
|
no_update_flag = true;
|
||||||
|
offset_top
|
||||||
|
},
|
||||||
|
CSSVerticalAlignBottom => {
|
||||||
|
if biggest_bottom < (top_from_base + bottom_from_base) {
|
||||||
|
biggest_bottom = top_from_base + bottom_from_base;
|
||||||
|
}
|
||||||
|
let offset_bottom = -(bottom_from_base + ascent);
|
||||||
|
no_update_flag = true;
|
||||||
|
offset_bottom
|
||||||
|
},
|
||||||
|
CSSVerticalAlignLength(length) => {
|
||||||
|
let length_offset = match length {
|
||||||
|
Em(l) => Au::from_frac_px(cur_box.font_style().pt_size * l),
|
||||||
|
Px(l) => Au::from_frac_px(l),
|
||||||
|
};
|
||||||
|
-(length_offset + ascent)
|
||||||
|
},
|
||||||
|
CSSVerticalAlignPercentage(p) => {
|
||||||
|
let pt_size = cur_box.font_style().pt_size;
|
||||||
|
let line_height = scanner.calculate_line_height(cur_box, Au::from_pt(pt_size));
|
||||||
|
let percent_offset = line_height.scale_by(p / 100.0f);
|
||||||
|
-(percent_offset + ascent)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// If the current box has 'top' or 'bottom' value, no_update_flag is true.
|
||||||
|
// Otherwise, topmost and bottomost are updated.
|
||||||
|
if !no_update_flag && top_from_base > topmost {
|
||||||
|
topmost = top_from_base;
|
||||||
|
}
|
||||||
|
if !no_update_flag && bottom_from_base > bottommost {
|
||||||
|
bottommost = bottom_from_base;
|
||||||
|
}
|
||||||
|
|
||||||
|
do cur_box.with_mut_base |base| {
|
||||||
|
base.position.origin.y = line.bounds.origin.y + offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the distance from baseline to the top of the biggest box with 'bottom' value.
|
||||||
|
// Then, if necessary, update the topmost.
|
||||||
|
let topmost_of_bottom = biggest_bottom - bottommost;
|
||||||
|
if topmost_of_bottom > topmost {
|
||||||
|
topmost = topmost_of_bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the distance from baseline to the bottom of the biggest box with 'top' value.
|
||||||
|
// Then, if necessary, update the bottommost.
|
||||||
|
let bottommost_of_top = biggest_top - topmost;
|
||||||
|
if bottommost_of_top > bottommost {
|
||||||
|
bottommost = bottommost_of_top;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now, the baseline offset from the top of linebox is set as topmost.
|
||||||
|
let baseline_offset = topmost;
|
||||||
|
|
||||||
|
// All boxes' y position is updated following the new baseline offset.
|
||||||
for box_i in line.range.eachi() {
|
for box_i in line.range.eachi() {
|
||||||
let cur_box = self.boxes[box_i];
|
let cur_box = self.boxes[box_i];
|
||||||
|
let adjust_offset = match cur_box.vertical_align() {
|
||||||
// TODO(#226): This is completely wrong. We need to use the element's `line-height`
|
CSSVerticalAlignTop => {
|
||||||
// when calculating line box height. Then we should go back over and set Y offsets
|
Au(0)
|
||||||
// according to the `vertical-align` property of the containing block.
|
|
||||||
let offset = match cur_box {
|
|
||||||
TextRenderBoxClass(text_box) => {
|
|
||||||
baseline_offset - text_box.run.font.metrics.ascent
|
|
||||||
},
|
},
|
||||||
_ => Au(0),
|
CSSVerticalAlignBottom => {
|
||||||
|
baseline_offset + bottommost
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
baseline_offset
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
do cur_box.with_mut_base |base| {
|
do cur_box.with_mut_base |base| {
|
||||||
base.position.origin.y = offset + line.bounds.origin.y;
|
base.position.origin.y = base.position.origin.y + adjust_offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is used to set the top y position of the next linebox in the next loop.
|
||||||
|
line_height_offset = line_height_offset + topmost + bottommost - line.bounds.size.height;
|
||||||
|
line.bounds.size.height = topmost + bottommost;
|
||||||
} // End of `lines.each` loop.
|
} // End of `lines.each` loop.
|
||||||
|
|
||||||
self.common.position.size.height =
|
self.common.position.size.height =
|
||||||
|
|
|
@ -80,6 +80,7 @@ pub trait RenderListener {
|
||||||
pub trait ScriptListener : Clone {
|
pub trait ScriptListener : Clone {
|
||||||
fn set_ready_state(&self, ReadyState);
|
fn set_ready_state(&self, ReadyState);
|
||||||
fn invalidate_rect(&self, PipelineId, Rect<uint>);
|
fn invalidate_rect(&self, PipelineId, Rect<uint>);
|
||||||
|
fn close(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The interface used by the quadtree to get info about LayerBuffers
|
/// The interface used by the quadtree to get info about LayerBuffers
|
||||||
|
|
|
@ -230,6 +230,12 @@ DOMInterfaces = {
|
||||||
'pointerType': '',
|
'pointerType': '',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'HTMLFormElement': {
|
||||||
|
'nativeType': 'AbstractNode<ScriptView>',
|
||||||
|
'pointerType': '',
|
||||||
|
'register': False
|
||||||
|
},
|
||||||
|
|
||||||
'HTMLOptionsCollection': [
|
'HTMLOptionsCollection': [
|
||||||
{
|
{
|
||||||
'nativeType': 'nsHTMLOptionCollection',
|
'nativeType': 'nsHTMLOptionCollection',
|
||||||
|
@ -361,12 +367,6 @@ DOMInterfaces = {
|
||||||
'resultNotAddRefed': [ 'getItem' ]
|
'resultNotAddRefed': [ 'getItem' ]
|
||||||
}],
|
}],
|
||||||
|
|
||||||
'Text': {
|
|
||||||
'nativeType': 'AbstractNode<ScriptView>',
|
|
||||||
'concreteType': 'Text',
|
|
||||||
'pointerType': ''
|
|
||||||
},
|
|
||||||
|
|
||||||
'UIEvent': {
|
'UIEvent': {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -542,12 +542,17 @@ def addExternalIface(iface, nativeType=None, headerFile=None, pointerType=None):
|
||||||
domInterface['pointerType'] = pointerType
|
domInterface['pointerType'] = pointerType
|
||||||
DOMInterfaces[iface] = domInterface
|
DOMInterfaces[iface] = domInterface
|
||||||
|
|
||||||
def addHTMLElement(element):
|
def addHTMLElement(element, concrete=None):
|
||||||
DOMInterfaces[element] = {
|
DOMInterfaces[element] = {
|
||||||
'nativeType': 'AbstractNode<ScriptView>',
|
'nativeType': 'AbstractNode<ScriptView>',
|
||||||
'pointerType': ''
|
'pointerType': '',
|
||||||
|
'concreteType': concrete if concrete else element
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addHTMLElement('Comment')
|
||||||
|
addHTMLElement('DocumentType', concrete='DocumentType<ScriptView>')
|
||||||
|
addHTMLElement('Text')
|
||||||
|
|
||||||
addHTMLElement('HTMLAnchorElement')
|
addHTMLElement('HTMLAnchorElement')
|
||||||
addHTMLElement('HTMLAppletElement')
|
addHTMLElement('HTMLAppletElement')
|
||||||
addHTMLElement('HTMLAreaElement')
|
addHTMLElement('HTMLAreaElement')
|
||||||
|
@ -579,11 +584,19 @@ addHTMLElement('HTMLLIElement')
|
||||||
addHTMLElement('HTMLLinkElement')
|
addHTMLElement('HTMLLinkElement')
|
||||||
addHTMLElement('HTMLMapElement')
|
addHTMLElement('HTMLMapElement')
|
||||||
addHTMLElement('HTMLMetaElement')
|
addHTMLElement('HTMLMetaElement')
|
||||||
|
addHTMLElement('HTMLMeterElement')
|
||||||
|
addHTMLElement('HTMLModElement')
|
||||||
|
addHTMLElement('HTMLObjectElement')
|
||||||
addHTMLElement('HTMLOListElement')
|
addHTMLElement('HTMLOListElement')
|
||||||
|
addHTMLElement('HTMLOptGroupElement')
|
||||||
|
addHTMLElement('HTMLOptionElement')
|
||||||
|
addHTMLElement('HTMLOutputElement')
|
||||||
addHTMLElement('HTMLParagraphElement')
|
addHTMLElement('HTMLParagraphElement')
|
||||||
|
addHTMLElement('HTMLParamElement')
|
||||||
addHTMLElement('HTMLProgressElement')
|
addHTMLElement('HTMLProgressElement')
|
||||||
addHTMLElement('HTMLQuoteElement')
|
addHTMLElement('HTMLQuoteElement')
|
||||||
addHTMLElement('HTMLScriptElement')
|
addHTMLElement('HTMLScriptElement')
|
||||||
|
addHTMLElement('HTMLSelectElement')
|
||||||
addHTMLElement('HTMLSourceElement')
|
addHTMLElement('HTMLSourceElement')
|
||||||
addHTMLElement('HTMLSpanElement')
|
addHTMLElement('HTMLSpanElement')
|
||||||
addHTMLElement('HTMLStyleElement')
|
addHTMLElement('HTMLStyleElement')
|
||||||
|
@ -597,6 +610,7 @@ addHTMLElement('HTMLTextAreaElement')
|
||||||
addHTMLElement('HTMLTimeElement')
|
addHTMLElement('HTMLTimeElement')
|
||||||
addHTMLElement('HTMLTitleElement')
|
addHTMLElement('HTMLTitleElement')
|
||||||
addHTMLElement('HTMLUListElement')
|
addHTMLElement('HTMLUListElement')
|
||||||
|
addHTMLElement('HTMLUnknownElement')
|
||||||
|
|
||||||
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
|
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
|
||||||
# macros added for it
|
# macros added for it
|
||||||
|
@ -605,8 +619,6 @@ def addExternalHTMLElement(element):
|
||||||
addExternalIface(element, nativeType=nativeElement,
|
addExternalIface(element, nativeType=nativeElement,
|
||||||
headerFile=nativeElement + '.h')
|
headerFile=nativeElement + '.h')
|
||||||
|
|
||||||
addExternalHTMLElement('HTMLOptionElement')
|
|
||||||
addExternalHTMLElement('HTMLOptGroupElement')
|
|
||||||
addExternalHTMLElement('HTMLVideoElement')
|
addExternalHTMLElement('HTMLVideoElement')
|
||||||
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')
|
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')
|
||||||
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
|
addExternalIface('CanvasPattern', headerFile='nsIDOMCanvasRenderingContext2D.h')
|
||||||
|
|
|
@ -92,7 +92,7 @@ class CastableObjectUnwrapper():
|
||||||
|
|
||||||
codeOnFailure is the code to run if unwrapping fails.
|
codeOnFailure is the code to run if unwrapping fails.
|
||||||
"""
|
"""
|
||||||
def __init__(self, descriptor, source, target, codeOnFailure):
|
def __init__(self, descriptor, source, target, codeOnFailure, isOptional=False):
|
||||||
assert descriptor.castable
|
assert descriptor.castable
|
||||||
|
|
||||||
self.substitution = { "type" : descriptor.nativeType,
|
self.substitution = { "type" : descriptor.nativeType,
|
||||||
|
@ -101,7 +101,8 @@ class CastableObjectUnwrapper():
|
||||||
"protoID" : "PrototypeList::id::" + descriptor.name + " as uint",
|
"protoID" : "PrototypeList::id::" + descriptor.name + " as uint",
|
||||||
"source" : source,
|
"source" : source,
|
||||||
"target" : target,
|
"target" : target,
|
||||||
"codeOnFailure" : CGIndenter(CGGeneric(codeOnFailure), 4).define() }
|
"codeOnFailure" : CGIndenter(CGGeneric(codeOnFailure), 4).define(),
|
||||||
|
"unwrapped_val" : "Some(val)" if isOptional else "val" }
|
||||||
if descriptor.hasXPConnectImpls:
|
if descriptor.hasXPConnectImpls:
|
||||||
# We don't use xpc_qsUnwrapThis because it will always throw on
|
# We don't use xpc_qsUnwrapThis because it will always throw on
|
||||||
# unwrap failure, whereas we want to control whether we throw or
|
# unwrap failure, whereas we want to control whether we throw or
|
||||||
|
@ -123,7 +124,7 @@ class CastableObjectUnwrapper():
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return string.Template(
|
return string.Template(
|
||||||
"""match unwrap_object(${source}, ${prototype}, ${depth}) {
|
"""match unwrap_object(${source}, ${prototype}, ${depth}) {
|
||||||
Ok(val) => ${target} = val,
|
Ok(val) => ${target} = ${unwrapped_val},
|
||||||
Err(()) => {
|
Err(()) => {
|
||||||
${codeOnFailure}
|
${codeOnFailure}
|
||||||
}
|
}
|
||||||
|
@ -141,10 +142,11 @@ class FailureFatalCastableObjectUnwrapper(CastableObjectUnwrapper):
|
||||||
"""
|
"""
|
||||||
As CastableObjectUnwrapper, but defaulting to throwing if unwrapping fails
|
As CastableObjectUnwrapper, but defaulting to throwing if unwrapping fails
|
||||||
"""
|
"""
|
||||||
def __init__(self, descriptor, source, target):
|
def __init__(self, descriptor, source, target, isOptional):
|
||||||
CastableObjectUnwrapper.__init__(self, descriptor, source, target,
|
CastableObjectUnwrapper.__init__(self, descriptor, source, target,
|
||||||
"return 0; //XXXjdm return Throw<%s>(cx, rv);" %
|
"return 0; //XXXjdm return Throw<%s>(cx, rv);" %
|
||||||
toStringBool(not descriptor.workers))
|
toStringBool(not descriptor.workers),
|
||||||
|
isOptional)
|
||||||
|
|
||||||
class CGThing():
|
class CGThing():
|
||||||
"""
|
"""
|
||||||
|
@ -229,9 +231,10 @@ class CGMethodCall(CGThing):
|
||||||
argCountCases.append(
|
argCountCases.append(
|
||||||
CGCase(str(argCount), None, True))
|
CGCase(str(argCount), None, True))
|
||||||
else:
|
else:
|
||||||
pass
|
sigIndex = signatures.index(signature)
|
||||||
argCountCases.append(
|
argCountCases.append(
|
||||||
CGCase(str(argCount), getPerSignatureCall(signature)))
|
CGCase(str(argCount), getPerSignatureCall(signature,
|
||||||
|
signatureIndex=sigIndex)))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
distinguishingIndex = method.distinguishingIndexForArgCount(argCount)
|
distinguishingIndex = method.distinguishingIndexForArgCount(argCount)
|
||||||
|
@ -302,7 +305,7 @@ class CGMethodCall(CGThing):
|
||||||
# above.
|
# above.
|
||||||
caseBody.append(CGGeneric("if JSVAL_IS_OBJECT(%s) {" %
|
caseBody.append(CGGeneric("if JSVAL_IS_OBJECT(%s) {" %
|
||||||
(distinguishingArg)))
|
(distinguishingArg)))
|
||||||
for sig in interfacesSigs:
|
for idx, sig in enumerate(interfacesSigs):
|
||||||
caseBody.append(CGIndenter(CGGeneric("loop {")));
|
caseBody.append(CGIndenter(CGGeneric("loop {")));
|
||||||
type = sig[1][distinguishingIndex].type
|
type = sig[1][distinguishingIndex].type
|
||||||
|
|
||||||
|
@ -326,7 +329,7 @@ class CGMethodCall(CGThing):
|
||||||
# distinguishingIndex + 1, since we already converted
|
# distinguishingIndex + 1, since we already converted
|
||||||
# distinguishingIndex.
|
# distinguishingIndex.
|
||||||
caseBody.append(CGIndenter(
|
caseBody.append(CGIndenter(
|
||||||
getPerSignatureCall(sig, distinguishingIndex + 1), 4))
|
getPerSignatureCall(sig, distinguishingIndex + 1, idx), 4))
|
||||||
caseBody.append(CGIndenter(CGGeneric("}")))
|
caseBody.append(CGIndenter(CGGeneric("}")))
|
||||||
|
|
||||||
caseBody.append(CGGeneric("}"))
|
caseBody.append(CGGeneric("}"))
|
||||||
|
@ -926,12 +929,14 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||||
descriptor,
|
descriptor,
|
||||||
"JSVAL_TO_OBJECT(${val})",
|
"JSVAL_TO_OBJECT(${val})",
|
||||||
"${declName}",
|
"${declName}",
|
||||||
failureCode))
|
failureCode,
|
||||||
|
isOptional or argIsPointer or type.nullable()))
|
||||||
else:
|
else:
|
||||||
templateBody += str(FailureFatalCastableObjectUnwrapper(
|
templateBody += str(FailureFatalCastableObjectUnwrapper(
|
||||||
descriptor,
|
descriptor,
|
||||||
"JSVAL_TO_OBJECT(${val})",
|
"JSVAL_TO_OBJECT(${val})",
|
||||||
"${declName}"))
|
"${declName}",
|
||||||
|
isOptional or argIsPointer or type.nullable()))
|
||||||
elif descriptor.interface.isCallback() and False:
|
elif descriptor.interface.isCallback() and False:
|
||||||
#XXXjdm unfinished
|
#XXXjdm unfinished
|
||||||
templateBody += str(CallbackObjectUnwrapper(
|
templateBody += str(CallbackObjectUnwrapper(
|
||||||
|
@ -3536,8 +3541,8 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
||||||
templateValues = {
|
templateValues = {
|
||||||
"declName": argument.identifier.name,
|
"declName": argument.identifier.name,
|
||||||
"holderName": argument.identifier.name + "_holder",
|
"holderName": argument.identifier.name + "_holder",
|
||||||
"val": "desc->value",
|
"val": "(*desc).value",
|
||||||
"valPtr": "&desc->value"
|
"valPtr": "&(*desc).value"
|
||||||
}
|
}
|
||||||
self.cgRoot.prepend(instantiateJSToNativeConversionTemplate(template, templateValues))
|
self.cgRoot.prepend(instantiateJSToNativeConversionTemplate(template, templateValues))
|
||||||
elif operation.isGetter():
|
elif operation.isGetter():
|
||||||
|
@ -3640,7 +3645,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
|
||||||
if not 'IndexedCreator' in self.descriptor.operations:
|
if not 'IndexedCreator' in self.descriptor.operations:
|
||||||
# FIXME need to check that this is a 'supported property index'
|
# FIXME need to check that this is a 'supported property index'
|
||||||
assert False
|
assert False
|
||||||
setOrIndexedGet += (" FillPropertyDescriptor(&mut *desc, proxy, JSVAL_VOID, false);\n" +
|
setOrIndexedGet += (" FillPropertyDescriptor(&mut *desc, proxy, false);\n" +
|
||||||
" return 1;\n" +
|
" return 1;\n" +
|
||||||
" }\n")
|
" }\n")
|
||||||
if self.descriptor.operations['NamedSetter']:
|
if self.descriptor.operations['NamedSetter']:
|
||||||
|
@ -3648,7 +3653,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
|
||||||
if not 'NamedCreator' in self.descriptor.operations:
|
if not 'NamedCreator' in self.descriptor.operations:
|
||||||
# FIXME need to check that this is a 'supported property name'
|
# FIXME need to check that this is a 'supported property name'
|
||||||
assert False
|
assert False
|
||||||
setOrIndexedGet += (" FillPropertyDescriptor(&mut *desc, proxy, JSVAL_VOID, false);\n" +
|
setOrIndexedGet += (" FillPropertyDescriptor(&mut *desc, proxy, false);\n" +
|
||||||
" return 1;\n" +
|
" return 1;\n" +
|
||||||
" }\n")
|
" }\n")
|
||||||
setOrIndexedGet += "}"
|
setOrIndexedGet += "}"
|
||||||
|
@ -3714,7 +3719,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
args = [Argument('*JSContext', 'cx'), Argument('*JSObject', 'proxy'),
|
args = [Argument('*JSContext', 'cx'), Argument('*JSObject', 'proxy'),
|
||||||
Argument('jsid', 'id'),
|
Argument('jsid', 'id'),
|
||||||
Argument('*JSPropertyDescriptor', 'desc')]
|
Argument('*JSPropertyDescriptor', 'desc')]
|
||||||
CGAbstractExternMethod.__init__(self, descriptor, "defineProperty", "bool", args)
|
CGAbstractExternMethod.__init__(self, descriptor, "defineProperty", "JSBool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
set = ""
|
set = ""
|
||||||
|
@ -3726,10 +3731,10 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
set += ("let index = GetArrayIndexFromId(cx, id);\n" +
|
set += ("let index = GetArrayIndexFromId(cx, id);\n" +
|
||||||
"if index.is_some() {\n" +
|
"if index.is_some() {\n" +
|
||||||
" let index = index.unwrap();\n" +
|
" let index = index.unwrap();\n" +
|
||||||
" let this: *%s = UnwrapProxy(proxy);\n" +
|
" let this: *mut %s = UnwrapProxy(proxy) as *mut %s;\n" +
|
||||||
CGIndenter(CGProxyIndexedSetter(self.descriptor)).define() +
|
CGIndenter(CGProxyIndexedSetter(self.descriptor)).define() +
|
||||||
" return 1;\n" +
|
" return 1;\n" +
|
||||||
"}\n") % (self.descriptor.concreteType)
|
"}\n") % (self.descriptor.concreteType, self.descriptor.concreteType)
|
||||||
elif self.descriptor.operations['IndexedGetter']:
|
elif self.descriptor.operations['IndexedGetter']:
|
||||||
set += ("if GetArrayIndexFromId(cx, id).is_some() {\n" +
|
set += ("if GetArrayIndexFromId(cx, id).is_some() {\n" +
|
||||||
" return 0;\n" +
|
" return 0;\n" +
|
||||||
|
@ -3775,7 +3780,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" return 1;\n"
|
" return 1;\n"
|
||||||
"}\n") % (self.descriptor.concreteType, self.descriptor.name)
|
"}\n") % (self.descriptor.concreteType, self.descriptor.name)
|
||||||
return set + """return proxyhandler::defineProperty(%s);""" % ", ".join(a.name for a in self.args)
|
return set + """return proxyhandler::defineProperty_(%s);""" % ", ".join(a.name for a in self.args)
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return self.getBody()
|
return self.getBody()
|
||||||
|
@ -4617,75 +4622,16 @@ class CGBindingRoot(CGThing):
|
||||||
'js::jsapi::*',
|
'js::jsapi::*',
|
||||||
'js::jsfriendapi::bindgen::*',
|
'js::jsfriendapi::bindgen::*',
|
||||||
'js::glue::*',
|
'js::glue::*',
|
||||||
'dom::characterdata::CharacterData', #XXXjdm
|
'dom::types::*',
|
||||||
'dom::node::{AbstractNode, Node, Text}', #XXXjdm
|
|
||||||
'dom::document::{Document, AbstractDocument}', #XXXjdm
|
|
||||||
'dom::element::{Element, HTMLHeadElement, HTMLHtmlElement}', #XXXjdm
|
|
||||||
'dom::element::{HTMLDivElement, HTMLSpanElement, HTMLParagraphElement}', #XXXjdm
|
|
||||||
'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm
|
|
||||||
'dom::htmlappletelement::HTMLAppletElement', #XXXjune0cho
|
|
||||||
'dom::htmlareaelement::HTMLAreaElement', #XXXjune0cho
|
|
||||||
'dom::htmlbaseelement::HTMLBaseElement', #XXXjune0cho
|
|
||||||
'dom::htmlbodyelement::HTMLBodyElement', #XXXjune0cho
|
|
||||||
'dom::htmlbrelement::HTMLBRElement', #XXXrecrack
|
|
||||||
'dom::htmlbuttonelement::HTMLButtonElement', #XXXjdm
|
|
||||||
'dom::htmlcanvaselement::HTMLCanvasElement',
|
|
||||||
'dom::htmldataelement::HTMLDataElement', #XXXjune0cho
|
|
||||||
'dom::htmldatalistelement::HTMLDataListElement',
|
|
||||||
'dom::htmldlistelement::HTMLDListElement',
|
|
||||||
'dom::htmldirectoryelement::HTMLDirectoryElement',
|
|
||||||
'dom::htmlelement::HTMLElement', #XXXjdm
|
|
||||||
'dom::htmlembedelement::HTMLEmbedElement', #XXXjdm
|
|
||||||
'dom::htmlfieldsetelement::HTMLFieldSetElement', #XXXjdm
|
|
||||||
'dom::htmlfontelement::HTMLFontElement', #XXXjdm
|
|
||||||
'dom::htmlframeelement::HTMLFrameElement', #XXXjdm
|
|
||||||
'dom::htmlframesetelement::HTMLFrameSetElement', #XXXjdm
|
|
||||||
'dom::htmldocument::HTMLDocument', #XXXjdm
|
|
||||||
'dom::htmlheadingelement::HTMLHeadingElement',
|
|
||||||
'dom::htmlhrelement::HTMLHRElement',
|
|
||||||
'dom::htmliframeelement::HTMLIFrameElement', #XXXjdm
|
|
||||||
'dom::htmlimageelement::HTMLImageElement', #XXXjdm
|
|
||||||
'dom::htmlinputelement::HTMLInputElement',
|
|
||||||
'dom::htmllielement::HTMLLIElement',
|
|
||||||
'dom::htmllinkelement::HTMLLinkElement', #XXXrecrack
|
|
||||||
'dom::htmlmapelement::HTMLMapElement',
|
|
||||||
'dom::htmlmetaelement::HTMLMetaElement',
|
|
||||||
'dom::htmlolistelement::HTMLOListElement',
|
|
||||||
'dom::htmlprogresselement::HTMLProgressElement',
|
|
||||||
'dom::htmlquoteelement::HTMLQuoteElement',
|
|
||||||
'dom::htmlscriptelement::HTMLScriptElement',
|
|
||||||
'dom::htmlsourceelement::HTMLSourceElement',
|
|
||||||
'dom::htmlstyleelement::HTMLStyleElement',
|
|
||||||
'dom::htmltablecaptionelement::HTMLTableCaptionElement',
|
|
||||||
'dom::htmltableelement::HTMLTableElement',
|
|
||||||
'dom::htmltablecellelement::HTMLTableCellElement',
|
|
||||||
'dom::htmltablecolelement::HTMLTableColElement',
|
|
||||||
'dom::htmltablerowelement::HTMLTableRowElement',
|
|
||||||
'dom::htmltablesectionelement::HTMLTableSectionElement',
|
|
||||||
'dom::htmltextareaelement::HTMLTextAreaElement',
|
|
||||||
'dom::htmltimeelement::HTMLTimeElement',
|
|
||||||
'dom::htmltitleelement::HTMLTitleElement', #XXXyusukesuzuki
|
|
||||||
'dom::htmlulistelement::HTMLUListElement',
|
|
||||||
'dom::bindings::utils::*',
|
'dom::bindings::utils::*',
|
||||||
'dom::bindings::conversions::*',
|
'dom::bindings::conversions::*',
|
||||||
'dom::blob::*', #XXXjdm
|
|
||||||
'dom::clientrect::*', #XXXjdm
|
|
||||||
'dom::clientrectlist::*', #XXXjdm
|
|
||||||
'dom::htmlcollection::*', #XXXjdm
|
|
||||||
'dom::bindings::proxyhandler::*',
|
|
||||||
'dom::domparser::*', #XXXjdm
|
|
||||||
'dom::event::*', #XXXjdm
|
|
||||||
'dom::eventtarget::*', #XXXjdm
|
|
||||||
'dom::formdata::*', #XXXjdm
|
|
||||||
'dom::mouseevent::*', #XXXjdm
|
|
||||||
'dom::uievent::*', #XXXjdm
|
|
||||||
'dom::validitystate::*', #XXXjdm
|
|
||||||
'dom::windowproxy::*', #XXXjdm
|
|
||||||
'dom::window::Window', #XXXjdm
|
|
||||||
'dom::bindings::codegen::*', #XXXjdm
|
'dom::bindings::codegen::*', #XXXjdm
|
||||||
'script_task::{JSPageInfo, page_from_context}',
|
'script_task::{JSPageInfo, page_from_context}',
|
||||||
'dom::bindings::utils::EnumEntry',
|
'dom::bindings::utils::EnumEntry',
|
||||||
'dom::node::ScriptView',
|
'dom::bindings::proxyhandler',
|
||||||
|
'dom::bindings::proxyhandler::*',
|
||||||
|
'dom::document::AbstractDocument',
|
||||||
|
'dom::node::{AbstractNode, ScriptView}',
|
||||||
'servo_util::vec::zip_copies',
|
'servo_util::vec::zip_copies',
|
||||||
'std::cast',
|
'std::cast',
|
||||||
'std::libc',
|
'std::libc',
|
||||||
|
@ -4787,3 +4733,18 @@ class GlobalGenRoots():
|
||||||
# Done.
|
# Done.
|
||||||
return curr
|
return curr
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def InterfaceTypes(config):
|
||||||
|
|
||||||
|
descriptors = [d.name for d in config.getDescriptors(register=True)]
|
||||||
|
curr = CGList([CGGeneric(declare="pub use dom::%s::%s;\n" % (name.lower(), name)) for name in descriptors])
|
||||||
|
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)
|
||||||
|
return curr
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def BindingDeclarations(config):
|
||||||
|
|
||||||
|
descriptors = [d.name for d in config.getDescriptors(register=True)]
|
||||||
|
curr = CGList([CGGeneric(declare="pub mod %sBinding;\n" % name) for name in descriptors])
|
||||||
|
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)
|
||||||
|
return curr
|
||||||
|
|
15
src/components/script/dom/bindings/codegen/Comment.webidl
Normal file
15
src/components/script/dom/bindings/codegen/Comment.webidl
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://dom.spec.whatwg.org/#comment
|
||||||
|
*
|
||||||
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
|
* liability, trademark and document use rules apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Constructor(optional DOMString data = "")]
|
||||||
|
interface Comment : CharacterData {
|
||||||
|
};
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://dom.spec.whatwg.org/#documenttype
|
||||||
|
*
|
||||||
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
|
* liability, trademark and document use rules apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface DocumentType : Node {
|
||||||
|
readonly attribute DOMString name;
|
||||||
|
readonly attribute DOMString publicId;
|
||||||
|
readonly attribute DOMString systemId;
|
||||||
|
|
||||||
|
// Mozilla extension
|
||||||
|
//readonly attribute DOMString? internalSubset;
|
||||||
|
};
|
||||||
|
|
||||||
|
//DocumentType implements ChildNode;
|
|
@ -80,6 +80,12 @@ def main():
|
||||||
# Generate the common code.
|
# Generate the common code.
|
||||||
generate_file(config, 'RegisterBindings', 'declare+define')
|
generate_file(config, 'RegisterBindings', 'declare+define')
|
||||||
|
|
||||||
|
# Generate the type list.
|
||||||
|
generate_file(config, 'InterfaceTypes', 'declare+define')
|
||||||
|
|
||||||
|
# Generate the module declarations.
|
||||||
|
generate_file(config, 'BindingDeclarations', 'declare+define')
|
||||||
|
|
||||||
#XXXjdm No union support yet
|
#XXXjdm No union support yet
|
||||||
#generate_file(config, 'UnionTypes', 'declare')
|
#generate_file(config, 'UnionTypes', 'declare')
|
||||||
#generate_file(config, 'UnionConversions', 'declare')
|
#generate_file(config, 'UnionConversions', 'declare')
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
* and create derivative works of this document.
|
* and create derivative works of this document.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface HTMLFormElement;
|
// FIXME: servo#707
|
||||||
|
//interface HTMLFormElement;
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#the-button-element
|
// http://www.whatwg.org/specs/web-apps/current-work/#the-button-element
|
||||||
interface HTMLButtonElement : HTMLElement {
|
interface HTMLButtonElement : HTMLElement {
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#htmlformelement
|
||||||
|
*
|
||||||
|
* ⓒ Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[OverrideBuiltins]
|
||||||
|
interface HTMLFormElement : HTMLElement {
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString acceptCharset;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString action;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString autocomplete;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString enctype;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString encoding;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString method;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString name;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute boolean noValidate;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString target;
|
||||||
|
|
||||||
|
[Constant]
|
||||||
|
readonly attribute HTMLCollection elements;
|
||||||
|
[Pure]
|
||||||
|
readonly attribute long length;
|
||||||
|
|
||||||
|
getter Element (unsigned long index);
|
||||||
|
// TODO this should be: getter (RadioNodeList or HTMLInputElement or HTMLImageElement) (DOMString name);
|
||||||
|
// getter nsISupports (DOMString name);
|
||||||
|
|
||||||
|
[Throws]
|
||||||
|
void submit();
|
||||||
|
void reset();
|
||||||
|
boolean checkValidity();
|
||||||
|
};
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#the-meter-element
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#the-meter-element
|
||||||
|
interface HTMLMeterElement : HTMLElement {
|
||||||
|
[SetterThrows]
|
||||||
|
attribute double value;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute double min;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute double max;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute double low;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute double high;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute double optimum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The labels attribute will be done with bug 556743.
|
||||||
|
*/
|
||||||
|
//readonly attribute NodeList labels;
|
||||||
|
};
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#attributes-common-to-ins-and-del-elements
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#attributes-common-to-ins-and-del-elements
|
||||||
|
interface HTMLModElement : HTMLElement {
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString cite;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString dateTime;
|
||||||
|
};
|
|
@ -0,0 +1,201 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
|
||||||
|
[NeedNewResolve]
|
||||||
|
interface HTMLObjectElement : HTMLElement {
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString data;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString type;
|
||||||
|
// attribute boolean typeMustMatch;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString name;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString useMap;
|
||||||
|
[Pure]
|
||||||
|
readonly attribute HTMLFormElement? form;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString width;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString height;
|
||||||
|
// Not pure: can trigger about:blank instantiation
|
||||||
|
readonly attribute Document? contentDocument;
|
||||||
|
// Not pure: can trigger about:blank instantiation
|
||||||
|
readonly attribute WindowProxy? contentWindow;
|
||||||
|
|
||||||
|
readonly attribute boolean willValidate;
|
||||||
|
readonly attribute ValidityState validity;
|
||||||
|
readonly attribute DOMString validationMessage;
|
||||||
|
boolean checkValidity();
|
||||||
|
void setCustomValidity(DOMString error);
|
||||||
|
|
||||||
|
/*[Throws]
|
||||||
|
legacycaller any (any... arguments);*/
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial
|
||||||
|
partial interface HTMLObjectElement {
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString align;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString archive;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString code;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute boolean declare;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute unsigned long hspace;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString standby;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute unsigned long vspace;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString codeBase;
|
||||||
|
[Pure, SetterThrows]
|
||||||
|
attribute DOMString codeType;
|
||||||
|
|
||||||
|
[TreatNullAs=EmptyString, Pure, SetterThrows]
|
||||||
|
attribute DOMString border;
|
||||||
|
};
|
||||||
|
|
||||||
|
partial interface HTMLObjectElement {
|
||||||
|
// GetSVGDocument
|
||||||
|
Document? getSVGDocument();
|
||||||
|
};
|
||||||
|
|
||||||
|
/*[NoInterfaceObject]
|
||||||
|
interface MozObjectLoadingContent {
|
||||||
|
// Mirrored chrome-only scriptable nsIObjectLoadingContent methods. Please
|
||||||
|
// make sure to update this list if nsIObjectLoadingContent changes. Also,
|
||||||
|
// make sure everything on here is [ChromeOnly].
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long TYPE_LOADING = 0;
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long TYPE_IMAGE = 1;
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long TYPE_PLUGIN = 2;
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long TYPE_DOCUMENT = 3;
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long TYPE_NULL = 4;
|
||||||
|
|
||||||
|
// The content type is not supported (e.g. plugin not installed)
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_UNSUPPORTED = 0;
|
||||||
|
// Showing alternate content
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_ALTERNATE = 1;
|
||||||
|
// The plugin exists, but is disabled
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_DISABLED = 2;
|
||||||
|
// The plugin is blocklisted and disabled
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_BLOCKLISTED = 3;
|
||||||
|
// The plugin is considered outdated, but not disabled
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_OUTDATED = 4;
|
||||||
|
// The plugin has crashed
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_CRASHED = 5;
|
||||||
|
// Suppressed by security policy
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_SUPPRESSED = 6;
|
||||||
|
// Blocked by content policy
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_USER_DISABLED = 7;
|
||||||
|
/// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that
|
||||||
|
/// would be replaced by a real plugin if activated (playPlugin())
|
||||||
|
/// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and
|
||||||
|
/// <= PLUGIN_VULNERABLE_NO_UPDATE are click-to-play types.
|
||||||
|
// The plugin is disabled until the user clicks on it
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_CLICK_TO_PLAY = 8;
|
||||||
|
// The plugin is vulnerable (update available)
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9;
|
||||||
|
// The plugin is vulnerable (no update available)
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10;
|
||||||
|
// The plugin is in play preview mode
|
||||||
|
[ChromeOnly]
|
||||||
|
const unsigned long PLUGIN_PLAY_PREVIEW = 11;*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual mime type (the one we got back from the network
|
||||||
|
* request) for the element.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly]
|
||||||
|
readonly attribute DOMString actualType;*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of the content that's currently loaded. See
|
||||||
|
* the constants above for the list of possible values.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly]
|
||||||
|
readonly attribute unsigned long displayedType;*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the content type that corresponds to the give MIME type. See the
|
||||||
|
* constants above for the list of possible values. If nothing else fits,
|
||||||
|
* TYPE_NULL will be returned.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly]
|
||||||
|
unsigned long getContentTypeForMIMEType(DOMString aMimeType);*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will play a plugin that has been stopped by the
|
||||||
|
* click-to-play plugins or play-preview features.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly, Throws]
|
||||||
|
void playPlugin();*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This attribute will return true if the current content type has been
|
||||||
|
* activated, either explicitly or by passing checks that would have it be
|
||||||
|
* click-to-play or play-preview.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly]
|
||||||
|
readonly attribute boolean activated;*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URL of the data/src loaded in the object. This may be null (i.e.
|
||||||
|
* an <embed> with no src).
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly]
|
||||||
|
readonly attribute URI? srcURI;
|
||||||
|
|
||||||
|
[ChromeOnly]
|
||||||
|
readonly attribute unsigned long defaultFallbackType;
|
||||||
|
|
||||||
|
[ChromeOnly]
|
||||||
|
readonly attribute unsigned long pluginFallbackType;*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this object currently owns a running plugin, regardless of whether or
|
||||||
|
* not one is pending spawn/despawn.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly]
|
||||||
|
readonly attribute boolean hasRunningPlugin;*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will disable the play-preview plugin state.
|
||||||
|
*/
|
||||||
|
/*[ChromeOnly, Throws]
|
||||||
|
void cancelPlayPreview();*/
|
||||||
|
//};
|
||||||
|
|
||||||
|
/*HTMLObjectElement implements MozImageLoadingContent;
|
||||||
|
HTMLObjectElement implements MozFrameLoaderOwner;
|
||||||
|
HTMLObjectElement implements MozObjectLoadingContent;*/
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#the-optgroup-element
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface HTMLOptGroupElement : HTMLElement {
|
||||||
|
[SetterThrows]
|
||||||
|
attribute boolean disabled;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString label;
|
||||||
|
};
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#the-option-element
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[NamedConstructor=Option(optional DOMString text, optional DOMString value, optional boolean defaultSelected, optional boolean selected)]
|
||||||
|
interface HTMLOptionElement : HTMLElement {
|
||||||
|
[SetterThrows]
|
||||||
|
attribute boolean disabled;
|
||||||
|
readonly attribute HTMLFormElement? form;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString label;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute boolean defaultSelected;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute boolean selected;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString value;
|
||||||
|
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString text;
|
||||||
|
readonly attribute long index;
|
||||||
|
};
|
|
@ -0,0 +1,37 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#the-output-element
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#the-output-element
|
||||||
|
interface HTMLOutputElement : HTMLElement {
|
||||||
|
/*[PutForwards=value, Constant]
|
||||||
|
readonly attribute DOMSettableTokenList htmlFor;*/
|
||||||
|
readonly attribute HTMLFormElement? form;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString name;
|
||||||
|
|
||||||
|
[Constant]
|
||||||
|
readonly attribute DOMString type;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString defaultValue;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString value;
|
||||||
|
|
||||||
|
readonly attribute boolean willValidate;
|
||||||
|
readonly attribute ValidityState validity;
|
||||||
|
readonly attribute DOMString validationMessage;
|
||||||
|
boolean checkValidity();
|
||||||
|
void setCustomValidity(DOMString error);
|
||||||
|
|
||||||
|
// Not yet implemented (bug 556743).
|
||||||
|
// readonly attribute NodeList labels;
|
||||||
|
};
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#the-param-element
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#the-param-element
|
||||||
|
interface HTMLParamElement : HTMLElement {
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString name;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString value;
|
||||||
|
};
|
||||||
|
|
||||||
|
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||||
|
partial interface HTMLParamElement {
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString type;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString valueType;
|
||||||
|
};
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/html/#the-select-element
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface HTMLSelectElement : HTMLElement {
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute boolean autofocus;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute boolean disabled;
|
||||||
|
[Pure]
|
||||||
|
readonly attribute HTMLFormElement? form;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute boolean multiple;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute DOMString name;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute boolean required;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute unsigned long size;
|
||||||
|
|
||||||
|
[Pure]
|
||||||
|
readonly attribute DOMString type;
|
||||||
|
|
||||||
|
/*[Constant]
|
||||||
|
readonly attribute HTMLOptionsCollection options;*/
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute unsigned long length;
|
||||||
|
getter Element? item(unsigned long index);
|
||||||
|
HTMLOptionElement? namedItem(DOMString name);
|
||||||
|
/*[Throws]
|
||||||
|
void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);*/
|
||||||
|
void remove(long index);
|
||||||
|
[Throws]
|
||||||
|
setter creator void (unsigned long index, HTMLOptionElement? option);
|
||||||
|
|
||||||
|
// NYI: readonly attribute HTMLCollection selectedOptions;
|
||||||
|
[SetterThrows, Pure]
|
||||||
|
attribute long selectedIndex;
|
||||||
|
[Pure]
|
||||||
|
attribute DOMString value;
|
||||||
|
|
||||||
|
readonly attribute boolean willValidate;
|
||||||
|
readonly attribute ValidityState validity;
|
||||||
|
readonly attribute DOMString validationMessage;
|
||||||
|
boolean checkValidity();
|
||||||
|
void setCustomValidity(DOMString error);
|
||||||
|
|
||||||
|
// NYI: readonly attribute NodeList labels;
|
||||||
|
|
||||||
|
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=20720
|
||||||
|
void remove();
|
||||||
|
};
|
|
@ -0,0 +1,16 @@
|
||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*
|
||||||
|
* The origin of this IDL file is
|
||||||
|
* http://www.whatwg.org/specs/web-apps/current-work/ and
|
||||||
|
* http://dev.w3.org/csswg/cssom-view/
|
||||||
|
*
|
||||||
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||||
|
* Opera Software ASA. You are granted a license to use, reproduce
|
||||||
|
* and create derivative works of this document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface HTMLUnknownElement : HTMLElement {
|
||||||
|
};
|
|
@ -2,10 +2,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::types::*;
|
||||||
|
use dom::bindings::codegen::*;
|
||||||
use dom::bindings::node::unwrap;
|
use dom::bindings::node::unwrap;
|
||||||
use dom::bindings::utils::jsval_to_str;
|
use dom::bindings::utils::jsval_to_str;
|
||||||
use dom::bindings::utils::{domstring_to_jsval, WrapNewBindingObject};
|
use dom::bindings::utils::{domstring_to_jsval, WrapNewBindingObject};
|
||||||
use dom::bindings::utils::{str, CacheableWrapper, DOM_OBJECT_SLOT, DOMString};
|
use dom::bindings::utils::{str, CacheableWrapper, DOM_OBJECT_SLOT, DOMString};
|
||||||
|
use dom::bindings::utils::{BindingObject, WrapperCache};
|
||||||
use dom::element::Element;
|
use dom::element::Element;
|
||||||
use dom::element::{HTMLImageElementTypeId, HTMLHeadElementTypeId, HTMLScriptElementTypeId,
|
use dom::element::{HTMLImageElementTypeId, HTMLHeadElementTypeId, HTMLScriptElementTypeId,
|
||||||
HTMLDivElementTypeId};
|
HTMLDivElementTypeId};
|
||||||
|
@ -309,3 +312,149 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> jsobj {
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub macro_rules! generate_cacheable_wrapper(
|
||||||
|
($name: path, $wrap: path) => (
|
||||||
|
impl CacheableWrapper for $name {
|
||||||
|
fn get_wrappercache(&mut self) -> &mut WrapperCache {
|
||||||
|
self.parent.get_wrappercache()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
|
||||||
|
let mut unused = false;
|
||||||
|
$wrap(cx, scope, self, &mut unused)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
pub macro_rules! generate_binding_object(
|
||||||
|
($name: path) => (
|
||||||
|
impl BindingObject for $name {
|
||||||
|
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> {
|
||||||
|
self.parent.GetParentObject(cx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
generate_cacheable_wrapper!(Comment, CommentBinding::Wrap)
|
||||||
|
generate_binding_object!(Comment)
|
||||||
|
generate_cacheable_wrapper!(DocumentType<ScriptView>, DocumentTypeBinding::Wrap)
|
||||||
|
generate_binding_object!(DocumentType<ScriptView>)
|
||||||
|
generate_cacheable_wrapper!(Text, TextBinding::Wrap)
|
||||||
|
generate_binding_object!(Text)
|
||||||
|
generate_cacheable_wrapper!(HTMLHeadElement, HTMLHeadElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLHeadElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLAnchorElement, HTMLAnchorElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLAnchorElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLAppletElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLAreaElement, HTMLAreaElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLAreaElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLBaseElement, HTMLBaseElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLBaseElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLBodyElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLButtonElement, HTMLButtonElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLButtonElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLCanvasElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLDataListElement, HTMLDataListElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLDataListElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLDListElement, HTMLDListElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLDListElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLFormElement, HTMLFormElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLFormElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLFrameElement, HTMLFrameElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLFrameElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLFrameSetElement, HTMLFrameSetElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLFrameSetElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLBRElement, HTMLBRElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLBRElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLHRElement, HTMLHRElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLHRElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLHtmlElement, HTMLHtmlElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLHtmlElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLDataElement, HTMLDataElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLDataElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLDirectoryElement, HTMLDirectoryElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLDirectoryElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLDivElement, HTMLDivElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLDivElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLEmbedElement, HTMLEmbedElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLEmbedElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLFieldSetElement, HTMLFieldSetElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLFieldSetElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLFontElement, HTMLFontElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLFontElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLHeadingElement, HTMLHeadingElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLHeadingElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLIFrameElement, HTMLIFrameElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLIFrameElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLImageElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLInputElement, HTMLInputElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLInputElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLLIElement, HTMLLIElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLLIElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLLinkElement, HTMLLinkElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLLinkElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLMapElement, HTMLMapElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLMapElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLMetaElement, HTMLMetaElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLMetaElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLMeterElement, HTMLMeterElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLMeterElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLModElement, HTMLModElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLModElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLObjectElement, HTMLObjectElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLObjectElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLOListElement, HTMLOListElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLOListElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLOptGroupElement, HTMLOptGroupElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLOptGroupElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLOptionElement, HTMLOptionElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLOptionElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLOutputElement, HTMLOutputElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLOutputElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLParagraphElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLParamElement, HTMLParamElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLParamElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLProgressElement, HTMLProgressElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLProgressElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLQuoteElement, HTMLQuoteElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLQuoteElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLScriptElement, HTMLScriptElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLScriptElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLSelectElement, HTMLSelectElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLSelectElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLSourceElement, HTMLSourceElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLSourceElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLSpanElement, HTMLSpanElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLSpanElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLStyleElement, HTMLStyleElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLStyleElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTableElement, HTMLTableElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTableElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTableCaptionElement, HTMLTableCaptionElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTableCaptionElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTableCellElement, HTMLTableCellElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTableCellElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTableColElement, HTMLTableColElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTableColElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTableRowElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTableSectionElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTextAreaElement, HTMLTextAreaElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTextAreaElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTitleElement, HTMLTitleElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTitleElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLTimeElement, HTMLTimeElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLTimeElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLUListElement, HTMLUListElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLUListElement)
|
||||||
|
generate_cacheable_wrapper!(HTMLUnknownElement, HTMLUnknownElementBinding::Wrap)
|
||||||
|
generate_binding_object!(HTMLUnknownElement)
|
||||||
|
|
|
@ -3,74 +3,12 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::bindings::element;
|
use dom::bindings::element;
|
||||||
use dom::bindings::text;
|
|
||||||
use dom::bindings::utils;
|
use dom::bindings::utils;
|
||||||
use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
|
use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
|
||||||
use dom::element::{HTMLElementTypeId,
|
use dom::element::*;
|
||||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
|
use dom::types::*;
|
||||||
HTMLAreaElementTypeId, HTMLBaseElementTypeId,
|
|
||||||
HTMLBodyElementTypeId, HTMLBRElementTypeId, HTMLButtonElementTypeId,
|
|
||||||
HTMLCanvasElementTypeId, HTMLDataElementTypeId, HTMLDataListElementTypeId,
|
|
||||||
HTMLDirectoryElementTypeId, HTMLDivElementTypeId, HTMLEmbedElementTypeId,
|
|
||||||
HTMLFieldSetElementTypeId, HTMLFontElementTypeId, HTMLFrameElementTypeId,
|
|
||||||
HTMLFrameSetElementTypeId, HTMLHeadElementTypeId, HTMLHeadingElementTypeId,
|
|
||||||
HTMLHRElementTypeId, HTMLHtmlElementTypeId, HTMLIframeElementTypeId,
|
|
||||||
HTMLImageElementTypeId, HTMLInputElementTypeId, HTMLLIElementTypeId,
|
|
||||||
HTMLLinkElementTypeId, HTMLMapElementTypeId, HTMLMetaElementTypeId,
|
|
||||||
HTMLOListElementTypeId, HTMLParagraphElementTypeId,
|
|
||||||
HTMLProgressElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
|
|
||||||
HTMLSpanElementTypeId, HTMLSourceElementTypeId,
|
|
||||||
HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
|
|
||||||
HTMLTableElementTypeId, HTMLTableCaptionElementTypeId, HTMLTableCellElementTypeId,
|
|
||||||
HTMLTableColElementTypeId,
|
|
||||||
HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId, HTMLTimeElementTypeId,
|
|
||||||
HTMLTitleElementTypeId, HTMLUListElementTypeId, HTMLDListElementTypeId};
|
|
||||||
use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagraphElement, HTMLSpanElement};
|
|
||||||
use dom::htmlelement::HTMLElement;
|
|
||||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
|
||||||
use dom::htmlappletelement::HTMLAppletElement;
|
|
||||||
use dom::htmlareaelement::HTMLAreaElement;
|
|
||||||
use dom::htmlbaseelement::HTMLBaseElement;
|
|
||||||
use dom::htmlbodyelement::HTMLBodyElement;
|
|
||||||
use dom::htmlbuttonelement::HTMLButtonElement;
|
|
||||||
use dom::htmlhrelement::HTMLHRElement;
|
|
||||||
use dom::htmlbrelement::HTMLBRElement;
|
|
||||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
|
||||||
use dom::htmldataelement::HTMLDataElement;
|
|
||||||
use dom::htmldatalistelement::HTMLDataListElement;
|
|
||||||
use dom::htmldirectoryelement::HTMLDirectoryElement;
|
|
||||||
use dom::htmldlistelement::HTMLDListElement;
|
|
||||||
use dom::htmlembedelement::HTMLEmbedElement;
|
|
||||||
use dom::htmlfieldsetelement::HTMLFieldSetElement;
|
|
||||||
use dom::htmlfontelement::HTMLFontElement;
|
|
||||||
use dom::htmlframeelement::HTMLFrameElement;
|
|
||||||
use dom::htmlframesetelement::HTMLFrameSetElement;
|
|
||||||
use dom::htmlheadingelement::HTMLHeadingElement;
|
|
||||||
use dom::htmliframeelement::HTMLIFrameElement;
|
|
||||||
use dom::htmlimageelement::HTMLImageElement;
|
|
||||||
use dom::htmlinputelement::HTMLInputElement;
|
|
||||||
use dom::htmllielement::HTMLLIElement;
|
|
||||||
use dom::htmllinkelement::HTMLLinkElement;
|
|
||||||
use dom::htmlmapelement::HTMLMapElement;
|
|
||||||
use dom::htmlmetaelement::HTMLMetaElement;
|
|
||||||
use dom::htmlolistelement::HTMLOListElement;
|
|
||||||
use dom::htmlprogresselement::HTMLProgressElement;
|
|
||||||
use dom::htmlquoteelement::HTMLQuoteElement;
|
|
||||||
use dom::htmlscriptelement::HTMLScriptElement;
|
|
||||||
use dom::htmlsourceelement::HTMLSourceElement;
|
|
||||||
use dom::htmlstyleelement::HTMLStyleElement;
|
|
||||||
use dom::htmltableelement::HTMLTableElement;
|
|
||||||
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
|
|
||||||
use dom::htmltablecellelement::HTMLTableCellElement;
|
|
||||||
use dom::htmltablecolelement::HTMLTableColElement;
|
|
||||||
use dom::htmltablerowelement::HTMLTableRowElement;
|
|
||||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
|
||||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
|
||||||
use dom::htmltimeelement::HTMLTimeElement;
|
|
||||||
use dom::htmltitleelement::HTMLTitleElement;
|
|
||||||
use dom::htmlulistelement::HTMLUListElement;
|
|
||||||
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
|
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
|
||||||
use dom::node::{DoctypeNodeTypeId, ScriptView, Text};
|
use dom::node::{DoctypeNodeTypeId, ScriptView};
|
||||||
|
|
||||||
use std::cast;
|
use std::cast;
|
||||||
use std::libc::c_uint;
|
use std::libc::c_uint;
|
||||||
|
@ -126,7 +64,7 @@ pub fn init(compartment: @mut Compartment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! generate_element(
|
macro_rules! generate_element(
|
||||||
($name: ident) => ({
|
($name: path) => ({
|
||||||
let node: @mut $name = unsafe { cast::transmute(node.raw_object()) };
|
let node: @mut $name = unsafe { cast::transmute(node.raw_object()) };
|
||||||
node.wrap_object_shared(cx, ptr::null())
|
node.wrap_object_shared(cx, ptr::null())
|
||||||
})
|
})
|
||||||
|
@ -151,6 +89,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
||||||
ElementNodeTypeId(HTMLEmbedElementTypeId) => generate_element!(HTMLEmbedElement),
|
ElementNodeTypeId(HTMLEmbedElementTypeId) => generate_element!(HTMLEmbedElement),
|
||||||
ElementNodeTypeId(HTMLFieldSetElementTypeId) => generate_element!(HTMLFieldSetElement),
|
ElementNodeTypeId(HTMLFieldSetElementTypeId) => generate_element!(HTMLFieldSetElement),
|
||||||
ElementNodeTypeId(HTMLFontElementTypeId) => generate_element!(HTMLFontElement),
|
ElementNodeTypeId(HTMLFontElementTypeId) => generate_element!(HTMLFontElement),
|
||||||
|
ElementNodeTypeId(HTMLFormElementTypeId) => generate_element!(HTMLFormElement),
|
||||||
ElementNodeTypeId(HTMLFrameElementTypeId) => generate_element!(HTMLFrameElement),
|
ElementNodeTypeId(HTMLFrameElementTypeId) => generate_element!(HTMLFrameElement),
|
||||||
ElementNodeTypeId(HTMLFrameSetElementTypeId) => generate_element!(HTMLFrameSetElement),
|
ElementNodeTypeId(HTMLFrameSetElementTypeId) => generate_element!(HTMLFrameSetElement),
|
||||||
ElementNodeTypeId(HTMLHeadElementTypeId) => generate_element!(HTMLHeadElement),
|
ElementNodeTypeId(HTMLHeadElementTypeId) => generate_element!(HTMLHeadElement),
|
||||||
|
@ -164,11 +103,19 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
||||||
ElementNodeTypeId(HTMLLinkElementTypeId) => generate_element!(HTMLLinkElement),
|
ElementNodeTypeId(HTMLLinkElementTypeId) => generate_element!(HTMLLinkElement),
|
||||||
ElementNodeTypeId(HTMLMapElementTypeId) => generate_element!(HTMLMapElement),
|
ElementNodeTypeId(HTMLMapElementTypeId) => generate_element!(HTMLMapElement),
|
||||||
ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement),
|
ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement),
|
||||||
|
ElementNodeTypeId(HTMLMeterElementTypeId) => generate_element!(HTMLMeterElement),
|
||||||
|
ElementNodeTypeId(HTMLModElementTypeId) => generate_element!(HTMLModElement),
|
||||||
|
ElementNodeTypeId(HTMLObjectElementTypeId) => generate_element!(HTMLObjectElement),
|
||||||
ElementNodeTypeId(HTMLOListElementTypeId) => generate_element!(HTMLOListElement),
|
ElementNodeTypeId(HTMLOListElementTypeId) => generate_element!(HTMLOListElement),
|
||||||
|
ElementNodeTypeId(HTMLOptGroupElementTypeId) => generate_element!(HTMLOptGroupElement),
|
||||||
|
ElementNodeTypeId(HTMLOptionElementTypeId) => generate_element!(HTMLOptionElement),
|
||||||
|
ElementNodeTypeId(HTMLOutputElementTypeId) => generate_element!(HTMLOutputElement),
|
||||||
ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement),
|
ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement),
|
||||||
|
ElementNodeTypeId(HTMLParamElementTypeId) => generate_element!(HTMLParamElement),
|
||||||
ElementNodeTypeId(HTMLProgressElementTypeId) => generate_element!(HTMLProgressElement),
|
ElementNodeTypeId(HTMLProgressElementTypeId) => generate_element!(HTMLProgressElement),
|
||||||
ElementNodeTypeId(HTMLQuoteElementTypeId) => generate_element!(HTMLQuoteElement),
|
ElementNodeTypeId(HTMLQuoteElementTypeId) => generate_element!(HTMLQuoteElement),
|
||||||
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
|
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
|
||||||
|
ElementNodeTypeId(HTMLSelectElementTypeId) => generate_element!(HTMLSelectElement),
|
||||||
ElementNodeTypeId(HTMLSourceElementTypeId) => generate_element!(HTMLSourceElement),
|
ElementNodeTypeId(HTMLSourceElementTypeId) => generate_element!(HTMLSourceElement),
|
||||||
ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement),
|
ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement),
|
||||||
ElementNodeTypeId(HTMLStyleElementTypeId) => generate_element!(HTMLStyleElement),
|
ElementNodeTypeId(HTMLStyleElementTypeId) => generate_element!(HTMLStyleElement),
|
||||||
|
@ -182,13 +129,11 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
||||||
ElementNodeTypeId(HTMLTimeElementTypeId) => generate_element!(HTMLTimeElement),
|
ElementNodeTypeId(HTMLTimeElementTypeId) => generate_element!(HTMLTimeElement),
|
||||||
ElementNodeTypeId(HTMLTitleElementTypeId) => generate_element!(HTMLTitleElement),
|
ElementNodeTypeId(HTMLTitleElementTypeId) => generate_element!(HTMLTitleElement),
|
||||||
ElementNodeTypeId(HTMLUListElementTypeId) => generate_element!(HTMLUListElement),
|
ElementNodeTypeId(HTMLUListElementTypeId) => generate_element!(HTMLUListElement),
|
||||||
|
ElementNodeTypeId(HTMLUnknownElementTypeId) => generate_element!(HTMLUnknownElement),
|
||||||
ElementNodeTypeId(_) => element::create(cx, node).ptr,
|
ElementNodeTypeId(_) => element::create(cx, node).ptr,
|
||||||
CommentNodeTypeId |
|
CommentNodeTypeId => generate_element!(Comment),
|
||||||
DoctypeNodeTypeId => text::create(cx, node).ptr,
|
DoctypeNodeTypeId => generate_element!(DocumentType<ScriptView>),
|
||||||
TextNodeTypeId => {
|
TextNodeTypeId => generate_element!(Text)
|
||||||
let node: @mut Text = unsafe { cast::transmute(node.raw_object()) };
|
|
||||||
node.wrap_object_shared(cx, ptr::null())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ pub extern fn getPropertyDescriptor(cx: *JSContext, proxy: *JSObject, id: jsid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub extern fn defineProperty(cx: *JSContext, proxy: *JSObject, id: jsid,
|
#[fixed_stack_segment]
|
||||||
|
pub fn defineProperty_(cx: *JSContext, proxy: *JSObject, id: jsid,
|
||||||
desc: *JSPropertyDescriptor) -> JSBool {
|
desc: *JSPropertyDescriptor) -> JSBool {
|
||||||
unsafe {
|
unsafe {
|
||||||
if ((*desc).attrs & JSPROP_GETTER) != 0 && (*desc).setter == Some(JS_StrictPropertyStub) {
|
if ((*desc).attrs & JSPROP_GETTER) != 0 && (*desc).setter == Some(JS_StrictPropertyStub) {
|
||||||
|
@ -66,6 +67,11 @@ pub extern fn defineProperty(cx: *JSContext, proxy: *JSObject, id: jsid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub extern fn defineProperty(cx: *JSContext, proxy: *JSObject, id: jsid,
|
||||||
|
desc: *JSPropertyDescriptor) -> JSBool {
|
||||||
|
defineProperty_(cx, proxy, id, desc)
|
||||||
|
}
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
#[fixed_stack_segment]
|
||||||
pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
use dom::bindings::element;
|
|
||||||
use dom::bindings::node::unwrap;
|
|
||||||
use dom::bindings::utils;
|
|
||||||
use dom::bindings::utils::{DOM_OBJECT_SLOT, CacheableWrapper};
|
|
||||||
use dom::node::{AbstractNode, Text, Comment, Doctype, TextNodeTypeId, CommentNodeTypeId};
|
|
||||||
use dom::node::{DoctypeNodeTypeId, ScriptView};
|
|
||||||
|
|
||||||
use js::jsapi::{JSFreeOp, JSObject, JSContext};
|
|
||||||
use js::jsapi::{JS_SetReservedSlot};
|
|
||||||
use js::glue::{RUST_PRIVATE_TO_JSVAL};
|
|
||||||
use js::rust::{Compartment, jsobj};
|
|
||||||
|
|
||||||
use std::cast;
|
|
||||||
use std::libc;
|
|
||||||
|
|
||||||
extern fn finalize_text(_fop: *JSFreeOp, obj: *JSObject) {
|
|
||||||
debug!("text finalize: %?!", obj as uint);
|
|
||||||
unsafe {
|
|
||||||
let node: AbstractNode<ScriptView> = unwrap(obj);
|
|
||||||
let _elem: ~Text = cast::transmute(node.raw_object());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern fn finalize_comment(_fop: *JSFreeOp, obj: *JSObject) {
|
|
||||||
debug!("comment finalize: %?!", obj as uint);
|
|
||||||
unsafe {
|
|
||||||
let node: AbstractNode<ScriptView> = unwrap(obj);
|
|
||||||
let _elem: ~Comment = cast::transmute(node.raw_object());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern fn finalize_doctype(_fop: *JSFreeOp, obj: *JSObject) {
|
|
||||||
debug!("doctype finalize: %?!", obj as uint);
|
|
||||||
unsafe {
|
|
||||||
let node: AbstractNode<ScriptView> = unwrap(obj);
|
|
||||||
let _elem: ~Doctype<ScriptView> = cast::transmute(node.raw_object());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init(compartment: @mut Compartment) {
|
|
||||||
let _ = utils::define_empty_prototype(~"CharacterData", Some(~"Node"), compartment);
|
|
||||||
|
|
||||||
let _ = utils::define_empty_prototype(~"TextPrototype",
|
|
||||||
Some(~"CharacterData"),
|
|
||||||
compartment);
|
|
||||||
let _ = utils::define_empty_prototype(~"CommentPrototype",
|
|
||||||
Some(~"CharacterData"),
|
|
||||||
compartment);
|
|
||||||
let _ = utils::define_empty_prototype(~"DocumentTypePrototype",
|
|
||||||
Some(~"Node"),
|
|
||||||
compartment);
|
|
||||||
|
|
||||||
compartment.register_class(utils::instance_jsclass(~"Text",
|
|
||||||
finalize_text,
|
|
||||||
element::trace));
|
|
||||||
compartment.register_class(utils::instance_jsclass(~"Comment",
|
|
||||||
finalize_comment,
|
|
||||||
element::trace));
|
|
||||||
compartment.register_class(utils::instance_jsclass(~"DocumentType",
|
|
||||||
finalize_doctype,
|
|
||||||
element::trace));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
|
||||||
pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> jsobj {
|
|
||||||
let (proto, instance) = match node.type_id() {
|
|
||||||
TextNodeTypeId => (~"TextPrototype", ~"Text"),
|
|
||||||
CommentNodeTypeId => (~"CommentPrototype", ~"Comment"),
|
|
||||||
DoctypeNodeTypeId => (~"DocumentTypePrototype", ~"DocumentType"),
|
|
||||||
_ => fail!(~"text::create only handles textual nodes")
|
|
||||||
};
|
|
||||||
|
|
||||||
//XXXjdm the parent should probably be the node parent instead of the global
|
|
||||||
//TODO error checking
|
|
||||||
let compartment = utils::get_compartment(cx);
|
|
||||||
let obj = compartment.new_object_with_proto(instance,
|
|
||||||
proto,
|
|
||||||
compartment.global_obj.ptr).unwrap();
|
|
||||||
|
|
||||||
let cache = node.get_wrappercache();
|
|
||||||
assert!(cache.get_wrapper().is_null());
|
|
||||||
cache.set_wrapper(obj.ptr);
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
let raw_ptr = node.raw_object() as *libc::c_void;
|
|
||||||
JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT as u32, RUST_PRIVATE_TO_JSVAL(raw_ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
33
src/components/script/dom/comment.rs
Normal file
33
src/components/script/dom/comment.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, str, null_string, ErrorResult};
|
||||||
|
use dom::characterdata::CharacterData;
|
||||||
|
use dom::node::{AbstractNode, ScriptView, CommentNodeTypeId, Node};
|
||||||
|
use dom::window::Window;
|
||||||
|
|
||||||
|
/// An HTML comment.
|
||||||
|
pub struct Comment {
|
||||||
|
parent: CharacterData,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Comment {
|
||||||
|
/// Creates a new HTML comment.
|
||||||
|
pub fn new(text: ~str) -> Comment {
|
||||||
|
Comment {
|
||||||
|
parent: CharacterData::new(CommentNodeTypeId, text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Constructor(owner: @mut Window, data: &DOMString, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
|
||||||
|
let s = match *data {
|
||||||
|
str(ref s) => s.clone(),
|
||||||
|
null_string => ~""
|
||||||
|
};
|
||||||
|
unsafe {
|
||||||
|
let compartment = (*owner.page).js_info.get_ref().js_compartment;
|
||||||
|
Node::as_abstract_node(compartment.cx.ptr, @Comment::new(s))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,13 +5,15 @@
|
||||||
use dom::bindings::codegen::DocumentBinding;
|
use dom::bindings::codegen::DocumentBinding;
|
||||||
use dom::bindings::utils::{DOMString, WrapperCache, ErrorResult, null_string, str};
|
use dom::bindings::utils::{DOMString, WrapperCache, ErrorResult, null_string, str};
|
||||||
use dom::bindings::utils::{BindingObject, CacheableWrapper, rust_box, DerivedWrapper};
|
use dom::bindings::utils::{BindingObject, CacheableWrapper, rust_box, DerivedWrapper};
|
||||||
use dom::element::{Element, HTMLHtmlElement};
|
use dom::element::{Element};
|
||||||
use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId};
|
use dom::element::{HTMLHtmlElementTypeId, HTMLHeadElementTypeId, HTMLTitleElementTypeId};
|
||||||
use dom::event::Event;
|
use dom::event::Event;
|
||||||
use dom::htmlcollection::HTMLCollection;
|
use dom::htmlcollection::HTMLCollection;
|
||||||
use dom::htmldocument::HTMLDocument;
|
use dom::htmldocument::HTMLDocument;
|
||||||
use dom::htmlelement::HTMLElement;
|
use dom::htmlelement::HTMLElement;
|
||||||
use dom::node::{AbstractNode, ScriptView, Node, ElementNodeTypeId, Text};
|
use dom::htmlhtmlelement::HTMLHtmlElement;
|
||||||
|
use dom::node::{AbstractNode, ScriptView, Node, ElementNodeTypeId};
|
||||||
|
use dom::text::Text;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
use dom::windowproxy::WindowProxy;
|
use dom::windowproxy::WindowProxy;
|
||||||
use dom::htmltitleelement::HTMLTitleElement;
|
use dom::htmltitleelement::HTMLTitleElement;
|
||||||
|
|
50
src/components/script/dom/documenttype.rs
Normal file
50
src/components/script/dom/documenttype.rs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, str, null_string};
|
||||||
|
use dom::node::{ScriptView, Node, DoctypeNodeTypeId};
|
||||||
|
|
||||||
|
/// The `DOCTYPE` tag.
|
||||||
|
pub struct DocumentType<View> {
|
||||||
|
parent: Node<View>,
|
||||||
|
name: ~str,
|
||||||
|
public_id: Option<~str>,
|
||||||
|
system_id: Option<~str>,
|
||||||
|
force_quirks: bool
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DocumentType<ScriptView> {
|
||||||
|
/// Creates a new `DOCTYPE` tag.
|
||||||
|
pub fn new(name: ~str,
|
||||||
|
public_id: Option<~str>,
|
||||||
|
system_id: Option<~str>,
|
||||||
|
force_quirks: bool)
|
||||||
|
-> DocumentType<ScriptView> {
|
||||||
|
DocumentType {
|
||||||
|
parent: Node::new(DoctypeNodeTypeId),
|
||||||
|
name: name,
|
||||||
|
public_id: public_id,
|
||||||
|
system_id: system_id,
|
||||||
|
force_quirks: force_quirks,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Name(&self) -> DOMString {
|
||||||
|
str(self.name.clone())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn PublicId(&self) -> DOMString {
|
||||||
|
match self.public_id {
|
||||||
|
Some(ref s) => str(s.clone()),
|
||||||
|
None => null_string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SystemId(&self) -> DOMString {
|
||||||
|
match self.system_id {
|
||||||
|
Some(ref s) => str(s.clone()),
|
||||||
|
None => null_string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,9 +6,10 @@ use dom::bindings::codegen::DOMParserBinding;
|
||||||
use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
|
use dom::bindings::codegen::DOMParserBinding::SupportedTypeValues::{Text_html, Text_xml};
|
||||||
use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache, CacheableWrapper};
|
use dom::bindings::utils::{DOMString, ErrorResult, WrapperCache, CacheableWrapper};
|
||||||
use dom::document::{AbstractDocument, Document, XML};
|
use dom::document::{AbstractDocument, Document, XML};
|
||||||
use dom::element::{HTMLHtmlElement, HTMLHtmlElementTypeId};
|
use dom::element::HTMLHtmlElementTypeId;
|
||||||
use dom::htmldocument::HTMLDocument;
|
use dom::htmldocument::HTMLDocument;
|
||||||
use dom::htmlelement::HTMLElement;
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::htmlhtmlelement::HTMLHtmlElement;
|
||||||
use dom::node::Node;
|
use dom::node::Node;
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
|
|
||||||
|
|
|
@ -4,77 +4,12 @@
|
||||||
|
|
||||||
//! Element nodes.
|
//! Element nodes.
|
||||||
|
|
||||||
use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
|
|
||||||
HTMLAreaElementBinding, HTMLBaseElementBinding,
|
|
||||||
HTMLBodyElementBinding, HTMLBRElementBinding,
|
|
||||||
HTMLButtonElementBinding, HTMLCanvasElementBinding,
|
|
||||||
HTMLDataElementBinding, HTMLDataListElementBinding,
|
|
||||||
HTMLDirectoryElementBinding, HTMLDListElementBinding,
|
|
||||||
HTMLDivElementBinding, HTMLEmbedElementBinding,
|
|
||||||
HTMLFieldSetElementBinding, HTMLFontElementBinding,
|
|
||||||
HTMLFrameElementBinding, HTMLFrameSetElementBinding,
|
|
||||||
HTMLHeadElementBinding, HTMLHeadingElementBinding,
|
|
||||||
HTMLHRElementBinding, HTMLHtmlElementBinding,
|
|
||||||
HTMLIFrameElementBinding, HTMLImageElementBinding,
|
|
||||||
HTMLInputElementBinding, HTMLLIElementBinding,
|
|
||||||
HTMLLinkElementBinding, HTMLMapElementBinding,
|
|
||||||
HTMLMetaElementBinding,
|
|
||||||
HTMLOListElementBinding, HTMLParagraphElementBinding,
|
|
||||||
HTMLProgressElementBinding, HTMLQuoteElementBinding,
|
|
||||||
HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding,
|
|
||||||
HTMLStyleElementBinding, HTMLTableElementBinding,
|
|
||||||
HTMLTableCaptionElementBinding, HTMLTableCellElementBinding,
|
|
||||||
HTMLTableColElementBinding, HTMLTableRowElementBinding,
|
|
||||||
HTMLTableSectionElementBinding, HTMLTextAreaElementBinding,
|
|
||||||
HTMLTimeElementBinding, HTMLTitleElementBinding, HTMLUListElementBinding};
|
|
||||||
use dom::bindings::utils::{null_string, str};
|
use dom::bindings::utils::{null_string, str};
|
||||||
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, WrapperCache};
|
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, WrapperCache};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::htmlcollection::HTMLCollection;
|
||||||
use dom::clientrect::ClientRect;
|
use dom::clientrect::ClientRect;
|
||||||
use dom::clientrectlist::ClientRectList;
|
use dom::clientrectlist::ClientRectList;
|
||||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
|
||||||
use dom::htmlappletelement::HTMLAppletElement;
|
|
||||||
use dom::htmlareaelement::HTMLAreaElement;
|
|
||||||
use dom::htmlbaseelement::HTMLBaseElement;
|
|
||||||
use dom::htmlbodyelement::HTMLBodyElement;
|
|
||||||
use dom::htmlbrelement::HTMLBRElement;
|
|
||||||
use dom::htmlbuttonelement::HTMLButtonElement;
|
|
||||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
|
||||||
use dom::htmlcollection::HTMLCollection;
|
|
||||||
use dom::htmldataelement::HTMLDataElement;
|
|
||||||
use dom::htmldatalistelement::HTMLDataListElement;
|
|
||||||
use dom::htmldirectoryelement::HTMLDirectoryElement;
|
|
||||||
use dom::htmldlistelement::HTMLDListElement;
|
|
||||||
use dom::htmlelement::HTMLElement;
|
|
||||||
use dom::htmlembedelement::HTMLEmbedElement;
|
|
||||||
use dom::htmlfieldsetelement::HTMLFieldSetElement;
|
|
||||||
use dom::htmlfontelement::HTMLFontElement;
|
|
||||||
use dom::htmlframeelement::HTMLFrameElement;
|
|
||||||
use dom::htmlframesetelement::HTMLFrameSetElement;
|
|
||||||
use dom::htmlheadingelement::HTMLHeadingElement;
|
|
||||||
use dom::htmlhrelement::HTMLHRElement;
|
|
||||||
use dom::htmliframeelement::HTMLIFrameElement;
|
|
||||||
use dom::htmlimageelement::HTMLImageElement;
|
|
||||||
use dom::htmlinputelement::HTMLInputElement;
|
|
||||||
use dom::htmllielement::HTMLLIElement;
|
|
||||||
use dom::htmllinkelement::HTMLLinkElement;
|
|
||||||
use dom::htmlmapelement::HTMLMapElement;
|
|
||||||
use dom::htmlmetaelement::HTMLMetaElement;
|
|
||||||
use dom::htmlolistelement::HTMLOListElement;
|
|
||||||
use dom::htmlprogresselement::HTMLProgressElement;
|
|
||||||
use dom::htmlquoteelement::HTMLQuoteElement;
|
|
||||||
use dom::htmlscriptelement::HTMLScriptElement;
|
|
||||||
use dom::htmlsourceelement::HTMLSourceElement;
|
|
||||||
use dom::htmlstyleelement::HTMLStyleElement;
|
|
||||||
use dom::htmltableelement::HTMLTableElement;
|
|
||||||
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
|
|
||||||
use dom::htmltablecellelement::HTMLTableCellElement;
|
|
||||||
use dom::htmltablecolelement::HTMLTableColElement;
|
|
||||||
use dom::htmltablerowelement::HTMLTableRowElement;
|
|
||||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
|
||||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
|
||||||
use dom::htmltimeelement::HTMLTimeElement;
|
|
||||||
use dom::htmltitleelement::HTMLTitleElement;
|
|
||||||
use dom::htmlulistelement::HTMLUListElement;
|
|
||||||
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
|
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
|
||||||
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
|
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
|
||||||
use layout_interface::{ContentBoxesResponse};
|
use layout_interface::{ContentBoxesResponse};
|
||||||
|
@ -143,9 +78,15 @@ pub enum ElementTypeId {
|
||||||
HTMLLIElementTypeId,
|
HTMLLIElementTypeId,
|
||||||
HTMLMapElementTypeId,
|
HTMLMapElementTypeId,
|
||||||
HTMLMetaElementTypeId,
|
HTMLMetaElementTypeId,
|
||||||
|
HTMLMeterElementTypeId,
|
||||||
|
HTMLModElementTypeId,
|
||||||
|
HTMLObjectElementTypeId,
|
||||||
HTMLOListElementTypeId,
|
HTMLOListElementTypeId,
|
||||||
|
HTMLOptGroupElementTypeId,
|
||||||
HTMLOptionElementTypeId,
|
HTMLOptionElementTypeId,
|
||||||
|
HTMLOutputElementTypeId,
|
||||||
HTMLParagraphElementTypeId,
|
HTMLParagraphElementTypeId,
|
||||||
|
HTMLParamElementTypeId,
|
||||||
HTMLProgressElementTypeId,
|
HTMLProgressElementTypeId,
|
||||||
HTMLQuoteElementTypeId,
|
HTMLQuoteElementTypeId,
|
||||||
HTMLScriptElementTypeId,
|
HTMLScriptElementTypeId,
|
||||||
|
@ -164,170 +105,14 @@ pub enum ElementTypeId {
|
||||||
HTMLTimeElementTypeId,
|
HTMLTimeElementTypeId,
|
||||||
HTMLTitleElementTypeId,
|
HTMLTitleElementTypeId,
|
||||||
HTMLUListElementTypeId,
|
HTMLUListElementTypeId,
|
||||||
UnknownElementTypeId,
|
HTMLUnknownElementTypeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Regular old elements
|
// Regular old elements
|
||||||
//
|
//
|
||||||
|
|
||||||
pub struct HTMLDivElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLFormElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLHeadElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLHtmlElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLOptionElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLParagraphElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLSelectElement { parent: HTMLElement }
|
|
||||||
pub struct HTMLSmallElement { parent: HTMLElement }
|
pub struct HTMLSmallElement { parent: HTMLElement }
|
||||||
pub struct HTMLSpanElement { parent: HTMLElement }
|
|
||||||
pub struct UnknownElement { parent: HTMLElement }
|
|
||||||
|
|
||||||
impl HTMLHtmlElement {
|
|
||||||
pub fn Version(&self) -> DOMString {
|
|
||||||
null_string
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn SetVersion(&mut self, _version: &DOMString, _rv: &mut ErrorResult) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HTMLDivElement {
|
|
||||||
pub fn Align(&self) -> DOMString {
|
|
||||||
null_string
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HTMLParagraphElement {
|
|
||||||
pub fn Align(&self) -> DOMString {
|
|
||||||
null_string
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub macro_rules! generate_cacheable_wrapper(
|
|
||||||
($name: ident, $wrap: path) => (
|
|
||||||
impl CacheableWrapper for $name {
|
|
||||||
fn get_wrappercache(&mut self) -> &mut WrapperCache {
|
|
||||||
self.parent.get_wrappercache()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
|
|
||||||
let mut unused = false;
|
|
||||||
$wrap(cx, scope, self, &mut unused)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
pub macro_rules! generate_binding_object(
|
|
||||||
($name: ident) => (
|
|
||||||
impl BindingObject for $name {
|
|
||||||
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> {
|
|
||||||
self.parent.GetParentObject(cx)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
generate_cacheable_wrapper!(HTMLHeadElement, HTMLHeadElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLHeadElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLAnchorElement, HTMLAnchorElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLAnchorElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLAppletElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLAreaElement, HTMLAreaElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLAreaElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLBaseElement, HTMLBaseElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLBaseElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLBodyElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLButtonElement, HTMLButtonElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLButtonElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLCanvasElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLDataListElement, HTMLDataListElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLDataListElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLDListElement, HTMLDListElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLDListElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLFrameElement, HTMLFrameElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLFrameElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLFrameSetElement, HTMLFrameSetElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLFrameSetElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLBRElement, HTMLBRElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLBRElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLHRElement, HTMLHRElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLHRElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLHtmlElement, HTMLHtmlElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLHtmlElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLDataElement, HTMLDataElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLDataElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLDirectoryElement, HTMLDirectoryElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLDirectoryElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLDivElement, HTMLDivElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLDivElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLEmbedElement, HTMLEmbedElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLEmbedElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLFieldSetElement, HTMLFieldSetElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLFieldSetElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLFontElement, HTMLFontElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLFontElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLHeadingElement, HTMLHeadingElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLHeadingElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLIFrameElement, HTMLIFrameElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLIFrameElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLImageElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLInputElement, HTMLInputElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLInputElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLLIElement, HTMLLIElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLLIElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLLinkElement, HTMLLinkElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLLinkElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLMapElement, HTMLMapElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLMapElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLMetaElement, HTMLMetaElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLMetaElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLOListElement, HTMLOListElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLOListElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLParagraphElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLProgressElement, HTMLProgressElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLProgressElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLQuoteElement, HTMLQuoteElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLQuoteElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLScriptElement, HTMLScriptElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLScriptElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLSourceElement, HTMLSourceElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLSourceElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLSpanElement, HTMLSpanElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLSpanElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLStyleElement, HTMLStyleElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLStyleElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTableElement, HTMLTableElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTableElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTableCaptionElement, HTMLTableCaptionElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTableCaptionElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTableCellElement, HTMLTableCellElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTableCellElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTableColElement, HTMLTableColElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTableColElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTableRowElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTableSectionElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTextAreaElement, HTMLTextAreaElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTextAreaElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTitleElement, HTMLTitleElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTitleElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLTimeElement, HTMLTimeElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLTimeElement)
|
|
||||||
generate_cacheable_wrapper!(HTMLUListElement, HTMLUListElementBinding::Wrap)
|
|
||||||
generate_binding_object!(HTMLUListElement)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Element methods
|
// Element methods
|
||||||
|
|
19
src/components/script/dom/htmldivelement.rs
Normal file
19
src/components/script/dom/htmldivelement.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLDivElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLDivElement {
|
||||||
|
pub fn Align(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
115
src/components/script/dom/htmlformelement.rs
Normal file
115
src/components/script/dom/htmlformelement.rs
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{CacheableWrapper, DOMString, ErrorResult, null_string};
|
||||||
|
use dom::element::HTMLFormElementTypeId;
|
||||||
|
use dom::htmlcollection::HTMLCollection;
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::node::{AbstractNode, ElementNodeTypeId, Node, ScriptView};
|
||||||
|
|
||||||
|
use js::jsapi::{JSObject, JSContext};
|
||||||
|
|
||||||
|
pub struct HTMLFormElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLFormElement {
|
||||||
|
fn get_scope_and_cx(&self) -> (*JSObject, *JSContext) {
|
||||||
|
let doc = self.parent.parent.parent.owner_doc.unwrap();
|
||||||
|
let win = doc.with_base(|doc| doc.window.unwrap());
|
||||||
|
let cx = unsafe {(*win.page).js_info.get_ref().js_compartment.cx.ptr};
|
||||||
|
let cache = win.get_wrappercache();
|
||||||
|
let scope = cache.get_wrapper();
|
||||||
|
(scope, cx)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn AcceptCharset(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAcceptCharset(&mut self, _accept_charset: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Action(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAction(&mut self, _action: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Autocomplete(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAutocomplete(&mut self, _autocomplete: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Enctype(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetEnctype(&mut self, _enctype: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Encoding(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetEncoding(&mut self, _encoding: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Method(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetMethod(&mut self, _method: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Name(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn NoValidate(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetNoValidate(&mut self, _no_validate: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Target(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetTarget(&mut self, _target: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Elements(&self) -> @mut HTMLCollection {
|
||||||
|
let (scope, cx) = self.get_scope_and_cx();
|
||||||
|
HTMLCollection::new(~[], cx, scope)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Length(&self) -> i32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Submit(&self, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Reset(&self) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn CheckValidity(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> AbstractNode<ScriptView> {
|
||||||
|
let (_scope, cx) = self.get_scope_and_cx();
|
||||||
|
// FIXME: This should be replaced with a proper value according to the index
|
||||||
|
let node = @Node::new(ElementNodeTypeId(HTMLFormElementTypeId));
|
||||||
|
unsafe { return Node::as_abstract_node(cx, node) }
|
||||||
|
}
|
||||||
|
}
|
9
src/components/script/dom/htmlheadelement.rs
Normal file
9
src/components/script/dom/htmlheadelement.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLHeadElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
19
src/components/script/dom/htmlhtmlelement.rs
Normal file
19
src/components/script/dom/htmlhtmlelement.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLHtmlElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLHtmlElement {
|
||||||
|
pub fn Version(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetVersion(&mut self, _version: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
54
src/components/script/dom/htmlmeterelement.rs
Normal file
54
src/components/script/dom/htmlmeterelement.rs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::ErrorResult;
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLMeterElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLMeterElement {
|
||||||
|
pub fn Value(&self) -> f64 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValue(&mut self, _value: f64, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Min(&self) -> f64 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetMin(&mut self, _min: f64, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Max(&self) -> f64 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetMax(&mut self, _max: f64, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Low(&self) -> f64 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetLow(&mut self, _low: f64, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn High(&self) -> f64 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetHigh(&mut self, _high: f64, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Optimum(&self) -> f64 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetOptimum(&mut self, _optimum: f64, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
26
src/components/script/dom/htmlmodelement.rs
Normal file
26
src/components/script/dom/htmlmodelement.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLModElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLModElement {
|
||||||
|
pub fn Cite(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCite(&mut self, _cite: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn DateTime(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDateTime(&mut self, _datetime: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
163
src/components/script/dom/htmlobjectelement.rs
Normal file
163
src/components/script/dom/htmlobjectelement.rs
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
|
||||||
|
use dom::document::AbstractDocument;
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::node::{AbstractNode, ScriptView};
|
||||||
|
use dom::validitystate::ValidityState;
|
||||||
|
use dom::windowproxy::WindowProxy;
|
||||||
|
|
||||||
|
pub struct HTMLObjectElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLObjectElement {
|
||||||
|
pub fn Data(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetData(&mut self, _data: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Type(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetType(&mut self, _type: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Name(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn UseMap(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetUseMap(&mut self, _use_map: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetForm(&self) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Width(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetWidth(&mut self, _width: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Height(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetHeight(&mut self, _height: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetContentDocument(&self) -> Option<AbstractDocument> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetContentWindow(&self) -> Option<@mut WindowProxy> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn WillValidate(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Validity(&self) -> @mut ValidityState {
|
||||||
|
@mut ValidityState::valid()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ValidationMessage(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn CheckValidity(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCustomValidity(&mut self, _error: &DOMString) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Align(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Archive(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetArchive(&mut self, _archive: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Code(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCode(&mut self, _code: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Declare(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDeclare(&mut self, _declare: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Hspace(&self) -> u32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetHspace(&mut self, _hspace: u32, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Standby(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetStandby(&mut self, _standby: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Vspace(&self) -> u32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetVspace(&mut self, _vspace: u32, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn CodeBase(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCodeBase(&mut self, _codebase: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn CodeType(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCodeType(&mut self, _codetype: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Border(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetBorder(&mut self, _border: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetSVGDocument(&self) -> Option<AbstractDocument> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
26
src/components/script/dom/htmloptgroupelement.rs
Normal file
26
src/components/script/dom/htmloptgroupelement.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLOptGroupElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLOptGroupElement {
|
||||||
|
pub fn Disabled(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Label(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetLabel(&mut self, _label: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
63
src/components/script/dom/htmloptionelement.rs
Normal file
63
src/components/script/dom/htmloptionelement.rs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::node::{AbstractNode, ScriptView};
|
||||||
|
|
||||||
|
pub struct HTMLOptionElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLOptionElement {
|
||||||
|
pub fn Disabled(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetForm(&self) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Label(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetLabel(&mut self, _label: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn DefaultSelected(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDefaultSelected(&mut self, _default_selected: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Selected(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetSelected(&mut self, _selected: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Value(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValue(&mut self, _value: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Text(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetText(&mut self, _text: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Index(&self) -> i32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
71
src/components/script/dom/htmloutputelement.rs
Normal file
71
src/components/script/dom/htmloutputelement.rs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::node::{AbstractNode, ScriptView};
|
||||||
|
use dom::validitystate::ValidityState;
|
||||||
|
|
||||||
|
pub struct HTMLOutputElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLOutputElement {
|
||||||
|
pub fn GetForm(&self) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Name(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Type(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn DefaultValue(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDefaultValue(&mut self, _value: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Value(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValue(&mut self, _value: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn WillValidate(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetWillValidate(&mut self, _will_validate: bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Validity(&self) -> @mut ValidityState {
|
||||||
|
@mut ValidityState::valid()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValidity(&mut self, _validity: @mut ValidityState) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ValidationMessage(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValidationMessage(&mut self, _message: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn CheckValidity(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCustomValidity(&mut self, _error: &DOMString) {
|
||||||
|
}
|
||||||
|
}
|
19
src/components/script/dom/htmlparagraphelement.rs
Normal file
19
src/components/script/dom/htmlparagraphelement.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, null_string, ErrorResult};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLParagraphElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLParagraphElement {
|
||||||
|
pub fn Align(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
40
src/components/script/dom/htmlparamelement.rs
Normal file
40
src/components/script/dom/htmlparamelement.rs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLParamElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLParamElement {
|
||||||
|
pub fn Name(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Value(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValue(&mut self, _value: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Type(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetType(&mut self, _type: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ValueType(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValueType(&mut self, _value_type: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
}
|
134
src/components/script/dom/htmlselectelement.rs
Normal file
134
src/components/script/dom/htmlselectelement.rs
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::node::{AbstractNode, ScriptView};
|
||||||
|
use dom::validitystate::ValidityState;
|
||||||
|
|
||||||
|
pub struct HTMLSelectElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HTMLSelectElement {
|
||||||
|
pub fn Autofocus(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetAutofocus(&mut self, _autofocus: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Disabled(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetForm(&self) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Multiple(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetMultiple(&mut self, _multiple: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Name(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Required(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetRequired(&mut self, _multiple: bool, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Size(&self) -> u32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetSize(&mut self, _size: u32, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Type(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Length(&self) -> u32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetLength(&mut self, _length: u32, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Item(&self, _index: u32) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn NamedItem(&self, _name: &DOMString) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option<AbstractNode<ScriptView>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn IndexedSetter(&mut self, _index: u32, _option: Option<AbstractNode<ScriptView>>, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Remove_(&self) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Remove(&self, _index: i32) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SelectedIndex(&self) -> i32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetSelectedIndex(&mut self, _index: i32, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Value(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValue(&mut self, _value: &DOMString) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn WillValidate(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetWillValidate(&mut self, _will_validate: bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Validity(&self) -> @mut ValidityState {
|
||||||
|
@mut ValidityState::valid()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValidity(&mut self, _validity: @mut ValidityState) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ValidationMessage(&self) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetValidationMessage(&mut self, _message: &DOMString, _rv: &mut ErrorResult) {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn CheckValidity(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SetCustomValidity(&mut self, _error: &DOMString) {
|
||||||
|
}
|
||||||
|
}
|
9
src/components/script/dom/htmlspanelement.rs
Normal file
9
src/components/script/dom/htmlspanelement.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLSpanElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
9
src/components/script/dom/htmlunknownelement.rs
Normal file
9
src/components/script/dom/htmlunknownelement.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
|
||||||
|
pub struct HTMLUnknownElement {
|
||||||
|
parent: HTMLElement
|
||||||
|
}
|
|
@ -4,18 +4,16 @@
|
||||||
|
|
||||||
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
|
//! The core DOM types. Defines the basic DOM hierarchy as well as all the HTML elements.
|
||||||
|
|
||||||
use dom::bindings::codegen::TextBinding;
|
|
||||||
use dom::bindings::node;
|
use dom::bindings::node;
|
||||||
use dom::bindings::utils::{WrapperCache, DOMString, null_string, ErrorResult};
|
use dom::bindings::utils::{WrapperCache, DOMString, null_string, ErrorResult};
|
||||||
use dom::bindings::utils::{BindingObject, CacheableWrapper, rust_box};
|
use dom::bindings::utils::{BindingObject, CacheableWrapper, rust_box};
|
||||||
use dom::bindings;
|
use dom::bindings;
|
||||||
use dom::characterdata::CharacterData;
|
|
||||||
use dom::document::AbstractDocument;
|
use dom::document::AbstractDocument;
|
||||||
use dom::element::{Element, ElementTypeId, HTMLImageElementTypeId, HTMLIframeElementTypeId};
|
use dom::element::{Element, ElementTypeId, HTMLImageElementTypeId, HTMLIframeElementTypeId};
|
||||||
use dom::element::{HTMLStyleElementTypeId};
|
use dom::element::{HTMLStyleElementTypeId};
|
||||||
use dom::htmlimageelement::HTMLImageElement;
|
use dom::htmlimageelement::HTMLImageElement;
|
||||||
use dom::htmliframeelement::HTMLIFrameElement;
|
use dom::htmliframeelement::HTMLIFrameElement;
|
||||||
use dom::window::Window;
|
use dom::text::Text;
|
||||||
|
|
||||||
use std::cast;
|
use std::cast;
|
||||||
use std::cast::transmute;
|
use std::cast::transmute;
|
||||||
|
@ -99,77 +97,6 @@ pub enum NodeTypeId {
|
||||||
TextNodeTypeId,
|
TextNodeTypeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Basic node types
|
|
||||||
//
|
|
||||||
|
|
||||||
/// The `DOCTYPE` tag.
|
|
||||||
pub struct Doctype<View> {
|
|
||||||
parent: Node<View>,
|
|
||||||
name: ~str,
|
|
||||||
public_id: Option<~str>,
|
|
||||||
system_id: Option<~str>,
|
|
||||||
force_quirks: bool
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Doctype<ScriptView> {
|
|
||||||
/// Creates a new `DOCTYPE` tag.
|
|
||||||
pub fn new(name: ~str,
|
|
||||||
public_id: Option<~str>,
|
|
||||||
system_id: Option<~str>,
|
|
||||||
force_quirks: bool)
|
|
||||||
-> Doctype<ScriptView> {
|
|
||||||
Doctype {
|
|
||||||
parent: Node::new(DoctypeNodeTypeId),
|
|
||||||
name: name,
|
|
||||||
public_id: public_id,
|
|
||||||
system_id: system_id,
|
|
||||||
force_quirks: force_quirks,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An HTML comment.
|
|
||||||
pub struct Comment {
|
|
||||||
parent: CharacterData,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Comment {
|
|
||||||
/// Creates a new HTML comment.
|
|
||||||
pub fn new(text: ~str) -> Comment {
|
|
||||||
Comment {
|
|
||||||
parent: CharacterData::new(CommentNodeTypeId, text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An HTML text node.
|
|
||||||
pub struct Text {
|
|
||||||
parent: CharacterData,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Text {
|
|
||||||
/// Creates a new HTML text node.
|
|
||||||
pub fn new(text: ~str) -> Text {
|
|
||||||
Text {
|
|
||||||
parent: CharacterData::new(TextNodeTypeId, text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn Constructor(owner: @mut Window, text: &DOMString, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
|
|
||||||
let cx = unsafe {(*owner.page).js_info.get_ref().js_compartment.cx.ptr};
|
|
||||||
unsafe { Node::as_abstract_node(cx, @Text::new(text.to_str())) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn SplitText(&self, _offset: u32, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
|
|
||||||
fail!("unimplemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn GetWholeText(&self, _rv: &mut ErrorResult) -> DOMString {
|
|
||||||
null_string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<View> Clone for AbstractNode<View> {
|
impl<View> Clone for AbstractNode<View> {
|
||||||
fn clone(&self) -> AbstractNode<View> {
|
fn clone(&self) -> AbstractNode<View> {
|
||||||
*self
|
*self
|
||||||
|
@ -683,7 +610,6 @@ impl VoidPtrLike for AbstractNode<LayoutView> {
|
||||||
pub fn define_bindings(compartment: @mut Compartment) {
|
pub fn define_bindings(compartment: @mut Compartment) {
|
||||||
bindings::node::init(compartment);
|
bindings::node::init(compartment);
|
||||||
bindings::element::init(compartment);
|
bindings::element::init(compartment);
|
||||||
bindings::text::init(compartment);
|
|
||||||
bindings::utils::initialize_global(compartment.global_obj.ptr);
|
bindings::utils::initialize_global(compartment.global_obj.ptr);
|
||||||
bindings::codegen::RegisterBindings::Register(compartment);
|
bindings::codegen::RegisterBindings::Register(compartment);
|
||||||
}
|
}
|
||||||
|
@ -707,19 +633,3 @@ impl BindingObject for Node<ScriptView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CacheableWrapper for Text {
|
|
||||||
fn get_wrappercache(&mut self) -> &mut WrapperCache {
|
|
||||||
self.parent.get_wrappercache()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
|
|
||||||
let mut unused = false;
|
|
||||||
TextBinding::Wrap(cx, scope, self, &mut unused)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BindingObject for Text {
|
|
||||||
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper> {
|
|
||||||
self.parent.GetParentObject(cx)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
35
src/components/script/dom/text.rs
Normal file
35
src/components/script/dom/text.rs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::utils::{DOMString, ErrorResult, null_string};
|
||||||
|
use dom::characterdata::CharacterData;
|
||||||
|
use dom::node::{AbstractNode, ScriptView, Node, TextNodeTypeId};
|
||||||
|
use dom::window::Window;
|
||||||
|
|
||||||
|
/// An HTML text node.
|
||||||
|
pub struct Text {
|
||||||
|
parent: CharacterData,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Text {
|
||||||
|
/// Creates a new HTML text node.
|
||||||
|
pub fn new(text: ~str) -> Text {
|
||||||
|
Text {
|
||||||
|
parent: CharacterData::new(TextNodeTypeId, text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn Constructor(owner: @mut Window, text: &DOMString, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
|
||||||
|
let cx = unsafe {(*owner.page).js_info.get_ref().js_compartment.cx.ptr};
|
||||||
|
unsafe { Node::as_abstract_node(cx, @Text::new(text.to_str())) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn SplitText(&self, _offset: u32, _rv: &mut ErrorResult) -> AbstractNode<ScriptView> {
|
||||||
|
fail!("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn GetWholeText(&self, _rv: &mut ErrorResult) -> DOMString {
|
||||||
|
null_string
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,81 +2,14 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use dom::element::{HTMLElementTypeId,
|
|
||||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
|
|
||||||
HTMLAreaElementTypeId, HTMLBaseElementTypeId, HTMLBodyElementTypeId,
|
|
||||||
HTMLBRElementTypeId, HTMLButtonElementTypeId, HTMLCanvasElementTypeId,
|
|
||||||
HTMLDataElementTypeId, HTMLDataListElementTypeId, HTMLDivElementTypeId,
|
|
||||||
HTMLDirectoryElementTypeId, HTMLDListElementTypeId, HTMLEmbedElementTypeId,
|
|
||||||
HTMLFieldSetElementTypeId, HTMLFontElementTypeId, HTMLFormElementTypeId,
|
|
||||||
HTMLFrameElementTypeId, HTMLFrameSetElementTypeId, HTMLHRElementTypeId,
|
|
||||||
HTMLHeadElementTypeId, HTMLHtmlElementTypeId, HTMLImageElementTypeId,
|
|
||||||
HTMLIframeElementTypeId, HTMLInputElementTypeId, HTMLLinkElementTypeId,
|
|
||||||
HTMLLIElementTypeId, HTMLMapElementTypeId, HTMLMetaElementTypeId,
|
|
||||||
HTMLOListElementTypeId, HTMLOptionElementTypeId,
|
|
||||||
HTMLParagraphElementTypeId, HTMLProgressElementTypeId,
|
|
||||||
HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
|
|
||||||
HTMLSelectElementTypeId, HTMLSmallElementTypeId, HTMLSourceElementTypeId,
|
|
||||||
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
|
|
||||||
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
|
|
||||||
HTMLTableCaptionElementTypeId, HTMLTableColElementTypeId,
|
|
||||||
HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
|
|
||||||
HTMLTimeElementTypeId, HTMLTitleElementTypeId, HTMLUListElementTypeId,
|
|
||||||
UnknownElementTypeId};
|
|
||||||
use dom::element::{HTMLDivElement, HTMLFormElement,
|
|
||||||
HTMLHeadElement, HTMLHtmlElement,
|
|
||||||
HTMLOptionElement, HTMLParagraphElement,
|
|
||||||
HTMLSelectElement, HTMLSmallElement,
|
|
||||||
HTMLSpanElement};
|
|
||||||
use dom::element::{HTMLHeadingElementTypeId};
|
|
||||||
use dom::htmlbrelement::HTMLBRElement;
|
|
||||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
|
||||||
use dom::htmlappletelement::HTMLAppletElement;
|
|
||||||
use dom::htmlareaelement::HTMLAreaElement;
|
|
||||||
use dom::htmlbaseelement::HTMLBaseElement;
|
|
||||||
use dom::htmlbodyelement::HTMLBodyElement;
|
|
||||||
use dom::htmlbuttonelement::HTMLButtonElement;
|
|
||||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
|
||||||
use dom::htmldataelement::HTMLDataElement;
|
|
||||||
use dom::htmldatalistelement::HTMLDataListElement;
|
|
||||||
use dom::htmldirectoryelement::HTMLDirectoryElement;
|
|
||||||
use dom::htmldlistelement::HTMLDListElement;
|
|
||||||
use dom::htmlembedelement::HTMLEmbedElement;
|
|
||||||
use dom::htmlfieldsetelement::HTMLFieldSetElement;
|
|
||||||
use dom::htmlfontelement::HTMLFontElement;
|
|
||||||
use dom::htmlframeelement::HTMLFrameElement;
|
|
||||||
use dom::htmlframesetelement::HTMLFrameSetElement;
|
|
||||||
use dom::htmlheadingelement::{HTMLHeadingElement, Heading1, Heading2, Heading3, Heading4,
|
|
||||||
Heading5, Heading6};
|
|
||||||
use dom::htmlhrelement::HTMLHRElement;
|
|
||||||
use dom::htmliframeelement::{IFrameSize, HTMLIFrameElement};
|
|
||||||
use dom::htmlimageelement::HTMLImageElement;
|
|
||||||
use dom::htmlinputelement::HTMLInputElement;
|
|
||||||
use dom::htmllielement::HTMLLIElement;
|
|
||||||
use dom::htmllinkelement::HTMLLinkElement;
|
|
||||||
use dom::htmlmapelement::HTMLMapElement;
|
|
||||||
use dom::htmlmetaelement::HTMLMetaElement;
|
|
||||||
use dom::htmlolistelement::HTMLOListElement;
|
|
||||||
use dom::htmlprogresselement::HTMLProgressElement;
|
|
||||||
use dom::htmlquoteelement::HTMLQuoteElement;
|
|
||||||
use dom::htmlscriptelement::HTMLScriptElement;
|
|
||||||
use dom::htmlsourceelement::HTMLSourceElement;
|
|
||||||
use dom::htmlstyleelement::HTMLStyleElement;
|
|
||||||
use dom::htmltableelement::HTMLTableElement;
|
|
||||||
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
|
|
||||||
use dom::htmltablecellelement::HTMLTableCellElement;
|
|
||||||
use dom::htmltablecolelement::HTMLTableColElement;
|
|
||||||
use dom::htmltablerowelement::HTMLTableRowElement;
|
|
||||||
use dom::htmltablesectionelement::HTMLTableSectionElement;
|
|
||||||
use dom::htmltextareaelement::HTMLTextAreaElement;
|
|
||||||
use dom::htmltimeelement::HTMLTimeElement;
|
|
||||||
use dom::htmltitleelement::HTMLTitleElement;
|
|
||||||
use dom::htmlulistelement::HTMLUListElement;
|
|
||||||
use dom::element::Element;
|
|
||||||
use dom::htmlelement::HTMLElement;
|
|
||||||
use dom::node::{AbstractNode, Comment, Doctype, ElementNodeTypeId, Node, ScriptView};
|
|
||||||
use dom::node::{Text};
|
|
||||||
use dom::bindings::utils::str;
|
use dom::bindings::utils::str;
|
||||||
|
use dom::element::*;
|
||||||
|
use dom::htmlelement::HTMLElement;
|
||||||
|
use dom::htmlheadingelement::{Heading1, Heading2, Heading3, Heading4, Heading5, Heading6};
|
||||||
|
use dom::htmliframeelement::IFrameSize;
|
||||||
|
use dom::htmlformelement::HTMLFormElement;
|
||||||
|
use dom::node::{AbstractNode, ElementNodeTypeId, Node, ScriptView};
|
||||||
|
use dom::types::*;
|
||||||
use html::cssparse::{InlineProvenance, StylesheetProvenance, UrlProvenance, spawn_css_parser};
|
use html::cssparse::{InlineProvenance, StylesheetProvenance, UrlProvenance, spawn_css_parser};
|
||||||
use js::jsapi::JSContext;
|
use js::jsapi::JSContext;
|
||||||
use newcss::stylesheet::Stylesheet;
|
use newcss::stylesheet::Stylesheet;
|
||||||
|
@ -279,9 +212,15 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
||||||
handle_element!(cx, tag, "li", HTMLLIElementTypeId, HTMLLIElement, []);
|
handle_element!(cx, tag, "li", HTMLLIElementTypeId, HTMLLIElement, []);
|
||||||
handle_element!(cx, tag, "map", HTMLMapElementTypeId, HTMLMapElement, []);
|
handle_element!(cx, tag, "map", HTMLMapElementTypeId, HTMLMapElement, []);
|
||||||
handle_element!(cx, tag, "meta", HTMLMetaElementTypeId, HTMLMetaElement, []);
|
handle_element!(cx, tag, "meta", HTMLMetaElementTypeId, HTMLMetaElement, []);
|
||||||
|
handle_element!(cx, tag, "meter", HTMLMeterElementTypeId, HTMLMeterElement, []);
|
||||||
|
handle_element!(cx, tag, "mod", HTMLModElementTypeId, HTMLModElement, []);
|
||||||
|
handle_element!(cx, tag, "object", HTMLObjectElementTypeId, HTMLObjectElement, []);
|
||||||
handle_element!(cx, tag, "ol", HTMLOListElementTypeId, HTMLOListElement, []);
|
handle_element!(cx, tag, "ol", HTMLOListElementTypeId, HTMLOListElement, []);
|
||||||
handle_element!(cx, tag, "option", HTMLOptionElementTypeId, HTMLOptionElement, []);
|
handle_element!(cx, tag, "option", HTMLOptionElementTypeId, HTMLOptionElement, []);
|
||||||
|
handle_element!(cx, tag, "optgroup",HTMLOptGroupElementTypeId, HTMLOptGroupElement, []);
|
||||||
|
handle_element!(cx, tag, "output", HTMLOutputElementTypeId, HTMLOutputElement, []);
|
||||||
handle_element!(cx, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []);
|
handle_element!(cx, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []);
|
||||||
|
handle_element!(cx, tag, "param", HTMLParamElementTypeId, HTMLParamElement, []);
|
||||||
handle_element!(cx, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []);
|
handle_element!(cx, tag, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []);
|
||||||
handle_element!(cx, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []);
|
handle_element!(cx, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []);
|
||||||
handle_element!(cx, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []);
|
handle_element!(cx, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []);
|
||||||
|
@ -319,7 +258,10 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
||||||
handle_htmlelement!(cx, tag, "section", HTMLElementTypeId, HTMLElement);
|
handle_htmlelement!(cx, tag, "section", HTMLElementTypeId, HTMLElement);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Node::as_abstract_node(cx, @Element::new(UnknownElementTypeId, tag.to_str()))
|
let element = @HTMLUnknownElement {
|
||||||
|
parent: HTMLElement::new(HTMLUnknownElementTypeId, tag.to_str())
|
||||||
|
};
|
||||||
|
Node::as_abstract_node(cx, element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +326,7 @@ pub fn parse_html(cx: *JSContext,
|
||||||
public_id: public_id,
|
public_id: public_id,
|
||||||
system_id: system_id,
|
system_id: system_id,
|
||||||
force_quirks: force_quirks } = doctype;
|
force_quirks: force_quirks } = doctype;
|
||||||
let node = @Doctype::new(name,
|
let node = @DocumentType::new(name,
|
||||||
public_id,
|
public_id,
|
||||||
system_id,
|
system_id,
|
||||||
force_quirks);
|
force_quirks);
|
||||||
|
|
|
@ -26,88 +26,30 @@ pub mod dom {
|
||||||
pub mod bindings {
|
pub mod bindings {
|
||||||
pub mod element;
|
pub mod element;
|
||||||
pub mod node;
|
pub mod node;
|
||||||
pub mod text;
|
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
pub mod conversions;
|
pub mod conversions;
|
||||||
pub mod proxyhandler;
|
pub mod proxyhandler;
|
||||||
pub mod domparser;
|
pub mod domparser;
|
||||||
pub mod codegen {
|
pub mod codegen {
|
||||||
pub mod BlobBinding;
|
pub use self::BindingDeclarations::*;
|
||||||
pub mod CharacterDataBinding;
|
pub mod InterfaceTypes;
|
||||||
pub mod ClientRectBinding;
|
|
||||||
pub mod ClientRectListBinding;
|
|
||||||
pub mod DocumentBinding;
|
|
||||||
pub mod DOMParserBinding;
|
|
||||||
pub mod ElementBinding;
|
|
||||||
pub mod EventBinding;
|
|
||||||
pub mod EventTargetBinding;
|
|
||||||
pub mod FormDataBinding;
|
|
||||||
pub mod HTMLAnchorElementBinding;
|
|
||||||
pub mod HTMLAppletElementBinding;
|
|
||||||
pub mod HTMLAreaElementBinding;
|
|
||||||
pub mod HTMLBaseElementBinding;
|
|
||||||
pub mod HTMLBodyElementBinding;
|
|
||||||
pub mod HTMLBRElementBinding;
|
|
||||||
pub mod HTMLButtonElementBinding;
|
|
||||||
pub mod HTMLCanvasElementBinding;
|
|
||||||
pub mod HTMLCollectionBinding;
|
|
||||||
pub mod HTMLDataElementBinding;
|
|
||||||
pub mod HTMLDataListElementBinding;
|
|
||||||
pub mod HTMLDirectoryElementBinding;
|
|
||||||
pub mod HTMLDListElementBinding;
|
|
||||||
pub mod HTMLDivElementBinding;
|
|
||||||
pub mod HTMLDocumentBinding;
|
|
||||||
pub mod HTMLElementBinding;
|
|
||||||
pub mod HTMLEmbedElementBinding;
|
|
||||||
pub mod HTMLFieldSetElementBinding;
|
|
||||||
pub mod HTMLFontElementBinding;
|
|
||||||
pub mod HTMLFrameElementBinding;
|
|
||||||
pub mod HTMLFrameSetElementBinding;
|
|
||||||
pub mod HTMLHeadElementBinding;
|
|
||||||
pub mod HTMLHeadingElementBinding;
|
|
||||||
pub mod HTMLHRElementBinding;
|
|
||||||
pub mod HTMLHtmlElementBinding;
|
|
||||||
pub mod HTMLIFrameElementBinding;
|
|
||||||
pub mod HTMLImageElementBinding;
|
|
||||||
pub mod HTMLInputElementBinding;
|
|
||||||
pub mod HTMLLIElementBinding;
|
|
||||||
pub mod HTMLLinkElementBinding;
|
|
||||||
pub mod HTMLMapElementBinding;
|
|
||||||
pub mod HTMLMetaElementBinding;
|
|
||||||
pub mod HTMLOListElementBinding;
|
|
||||||
pub mod HTMLParagraphElementBinding;
|
|
||||||
pub mod HTMLProgressElementBinding;
|
|
||||||
pub mod HTMLQuoteElementBinding;
|
|
||||||
pub mod HTMLScriptElementBinding;
|
|
||||||
pub mod HTMLSourceElementBinding;
|
|
||||||
pub mod HTMLSpanElementBinding;
|
|
||||||
pub mod HTMLStyleElementBinding;
|
|
||||||
pub mod HTMLTableElementBinding;
|
|
||||||
pub mod HTMLTableCaptionElementBinding;
|
|
||||||
pub mod HTMLTableCellElementBinding;
|
|
||||||
pub mod HTMLTableColElementBinding;
|
|
||||||
pub mod HTMLTableRowElementBinding;
|
|
||||||
pub mod HTMLTableSectionElementBinding;
|
|
||||||
pub mod HTMLTextAreaElementBinding;
|
|
||||||
pub mod HTMLTimeElementBinding;
|
|
||||||
pub mod HTMLTitleElementBinding;
|
|
||||||
pub mod HTMLUListElementBinding;
|
|
||||||
pub mod MouseEventBinding;
|
|
||||||
pub mod NodeBinding;
|
|
||||||
pub mod PrototypeList;
|
pub mod PrototypeList;
|
||||||
pub mod RegisterBindings;
|
pub mod RegisterBindings;
|
||||||
pub mod TextBinding;
|
pub mod BindingDeclarations;
|
||||||
pub mod UIEventBinding;
|
|
||||||
pub mod ValidityStateBinding;
|
|
||||||
pub mod WindowBinding;
|
|
||||||
pub mod WindowProxyBinding;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod types {
|
||||||
|
pub use super::bindings::codegen::InterfaceTypes::*;
|
||||||
|
}
|
||||||
|
|
||||||
pub mod blob;
|
pub mod blob;
|
||||||
pub mod characterdata;
|
pub mod characterdata;
|
||||||
pub mod clientrect;
|
pub mod clientrect;
|
||||||
pub mod clientrectlist;
|
pub mod clientrectlist;
|
||||||
|
pub mod comment;
|
||||||
pub mod document;
|
pub mod document;
|
||||||
|
pub mod documenttype;
|
||||||
pub mod domparser;
|
pub mod domparser;
|
||||||
pub mod element;
|
pub mod element;
|
||||||
pub mod event;
|
pub mod event;
|
||||||
|
@ -125,16 +67,20 @@ pub mod dom {
|
||||||
pub mod htmldataelement;
|
pub mod htmldataelement;
|
||||||
pub mod htmldatalistelement;
|
pub mod htmldatalistelement;
|
||||||
pub mod htmldirectoryelement;
|
pub mod htmldirectoryelement;
|
||||||
|
pub mod htmldivelement;
|
||||||
pub mod htmldlistelement;
|
pub mod htmldlistelement;
|
||||||
pub mod htmldocument;
|
pub mod htmldocument;
|
||||||
pub mod htmlelement;
|
pub mod htmlelement;
|
||||||
pub mod htmlembedelement;
|
pub mod htmlembedelement;
|
||||||
pub mod htmlfieldsetelement;
|
pub mod htmlfieldsetelement;
|
||||||
pub mod htmlfontelement;
|
pub mod htmlfontelement;
|
||||||
|
pub mod htmlformelement;
|
||||||
pub mod htmlframeelement;
|
pub mod htmlframeelement;
|
||||||
pub mod htmlframesetelement;
|
pub mod htmlframesetelement;
|
||||||
|
pub mod htmlheadelement;
|
||||||
pub mod htmlheadingelement;
|
pub mod htmlheadingelement;
|
||||||
pub mod htmlhrelement;
|
pub mod htmlhrelement;
|
||||||
|
pub mod htmlhtmlelement;
|
||||||
pub mod htmliframeelement;
|
pub mod htmliframeelement;
|
||||||
pub mod htmlimageelement;
|
pub mod htmlimageelement;
|
||||||
pub mod htmlinputelement;
|
pub mod htmlinputelement;
|
||||||
|
@ -142,10 +88,20 @@ pub mod dom {
|
||||||
pub mod htmllinkelement;
|
pub mod htmllinkelement;
|
||||||
pub mod htmlmapelement;
|
pub mod htmlmapelement;
|
||||||
pub mod htmlmetaelement;
|
pub mod htmlmetaelement;
|
||||||
|
pub mod htmlmeterelement;
|
||||||
|
pub mod htmlmodelement;
|
||||||
|
pub mod htmlobjectelement;
|
||||||
pub mod htmlolistelement;
|
pub mod htmlolistelement;
|
||||||
|
pub mod htmloptgroupelement;
|
||||||
|
pub mod htmloptionelement;
|
||||||
|
pub mod htmloutputelement;
|
||||||
|
pub mod htmlparagraphelement;
|
||||||
|
pub mod htmlparamelement;
|
||||||
pub mod htmlprogresselement;
|
pub mod htmlprogresselement;
|
||||||
pub mod htmlquoteelement;
|
pub mod htmlquoteelement;
|
||||||
pub mod htmlscriptelement;
|
pub mod htmlscriptelement;
|
||||||
|
pub mod htmlselectelement;
|
||||||
|
pub mod htmlspanelement;
|
||||||
pub mod htmlsourceelement;
|
pub mod htmlsourceelement;
|
||||||
pub mod htmlstyleelement;
|
pub mod htmlstyleelement;
|
||||||
pub mod htmltableelement;
|
pub mod htmltableelement;
|
||||||
|
@ -158,9 +114,11 @@ pub mod dom {
|
||||||
pub mod htmltimeelement;
|
pub mod htmltimeelement;
|
||||||
pub mod htmltitleelement;
|
pub mod htmltitleelement;
|
||||||
pub mod htmlulistelement;
|
pub mod htmlulistelement;
|
||||||
|
pub mod htmlunknownelement;
|
||||||
pub mod mouseevent;
|
pub mod mouseevent;
|
||||||
pub mod node;
|
pub mod node;
|
||||||
pub mod uievent;
|
pub mod uievent;
|
||||||
|
pub mod text;
|
||||||
pub mod validitystate;
|
pub mod validitystate;
|
||||||
pub mod window;
|
pub mod window;
|
||||||
pub mod windowproxy;
|
pub mod windowproxy;
|
||||||
|
|
|
@ -566,6 +566,7 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
page.layout_chan.send(layout_interface::ExitMsg);
|
page.layout_chan.send(layout_interface::ExitMsg);
|
||||||
}
|
}
|
||||||
|
self.compositor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The entry point to document loading. Defines bindings, sets up the window and document
|
/// The entry point to document loading. Defines bindings, sets up the window and document
|
||||||
|
|
|
@ -8,6 +8,7 @@ use std::cell::Cell;
|
||||||
use std::comm::{Port, SharedChan};
|
use std::comm::{Port, SharedChan};
|
||||||
use extra::sort::tim_sort;
|
use extra::sort::tim_sort;
|
||||||
use std::iterator::AdditiveIterator;
|
use std::iterator::AdditiveIterator;
|
||||||
|
use extra::treemap::TreeMap;
|
||||||
|
|
||||||
// front-end representation of the profiler used to communicate with the profiler
|
// front-end representation of the profiler used to communicate with the profiler
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
|
@ -26,7 +27,14 @@ impl ProfilerChan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq, Clone)]
|
pub enum ProfilerMsg {
|
||||||
|
// Normal message used for reporting time
|
||||||
|
TimeMsg(ProfilerCategory, float),
|
||||||
|
// Message used to force print the profiling metrics
|
||||||
|
PrintMsg,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deriving(Eq, Clone, TotalEq, TotalOrd)]
|
||||||
pub enum ProfilerCategory {
|
pub enum ProfilerCategory {
|
||||||
CompositingCategory,
|
CompositingCategory,
|
||||||
LayoutQueryCategory,
|
LayoutQueryCategory,
|
||||||
|
@ -41,65 +49,36 @@ pub enum ProfilerCategory {
|
||||||
RenderingDrawingCategory,
|
RenderingDrawingCategory,
|
||||||
RenderingPrepBuffCategory,
|
RenderingPrepBuffCategory,
|
||||||
RenderingCategory,
|
RenderingCategory,
|
||||||
// hackish but helps prevent errors when adding new categories
|
// FIXME(rust#8803): workaround for lack of CTFE function on enum types to return length
|
||||||
NUM_BUCKETS,
|
NumBuckets,
|
||||||
}
|
|
||||||
// FIXME(#5873) this should be initialized by a NUM_BUCKETS cast,
|
|
||||||
static BUCKETS: uint = 13;
|
|
||||||
type ProfilerBuckets = [(ProfilerCategory, ~[float]), ..BUCKETS];
|
|
||||||
|
|
||||||
pub enum ProfilerMsg {
|
|
||||||
// Normal message used for reporting time
|
|
||||||
TimeMsg(ProfilerCategory, float),
|
|
||||||
// Message used to force print the profiling metrics
|
|
||||||
PrintMsg,
|
|
||||||
}
|
|
||||||
|
|
||||||
// back end of the profiler that handles data aggregation and performance metrics
|
|
||||||
pub struct Profiler {
|
|
||||||
port: Port<ProfilerMsg>,
|
|
||||||
buckets: ProfilerBuckets,
|
|
||||||
last_msg: Option<ProfilerMsg>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProfilerCategory {
|
impl ProfilerCategory {
|
||||||
// convenience function to not have to cast every time
|
// convenience function to not have to cast every time
|
||||||
pub fn num_buckets() -> uint {
|
pub fn num_buckets() -> uint {
|
||||||
NUM_BUCKETS as uint
|
NumBuckets as uint
|
||||||
}
|
}
|
||||||
|
|
||||||
// enumeration of all ProfilerCategory types
|
// enumeration of all ProfilerCategory types
|
||||||
// TODO(tkuehn): is there a better way to ensure proper order of categories?
|
|
||||||
fn empty_buckets() -> ProfilerBuckets {
|
fn empty_buckets() -> ProfilerBuckets {
|
||||||
let buckets = [
|
let mut buckets = TreeMap::new();
|
||||||
(CompositingCategory, ~[]),
|
buckets.insert(CompositingCategory, ~[]);
|
||||||
(LayoutQueryCategory, ~[]),
|
buckets.insert(LayoutQueryCategory, ~[]);
|
||||||
(LayoutPerformCategory, ~[]),
|
buckets.insert(LayoutPerformCategory, ~[]);
|
||||||
(LayoutAuxInitCategory, ~[]),
|
buckets.insert(LayoutAuxInitCategory, ~[]);
|
||||||
(LayoutSelectorMatchCategory, ~[]),
|
buckets.insert(LayoutSelectorMatchCategory, ~[]);
|
||||||
(LayoutTreeBuilderCategory, ~[]),
|
buckets.insert(LayoutTreeBuilderCategory, ~[]);
|
||||||
(LayoutMainCategory, ~[]),
|
buckets.insert(LayoutMainCategory, ~[]);
|
||||||
(LayoutShapingCategory, ~[]),
|
buckets.insert(LayoutShapingCategory, ~[]);
|
||||||
(LayoutDispListBuildCategory, ~[]),
|
buckets.insert(LayoutDispListBuildCategory, ~[]);
|
||||||
(GfxRegenAvailableFontsCategory, ~[]),
|
buckets.insert(GfxRegenAvailableFontsCategory, ~[]);
|
||||||
(RenderingDrawingCategory, ~[]),
|
buckets.insert(RenderingDrawingCategory, ~[]);
|
||||||
(RenderingPrepBuffCategory, ~[]),
|
buckets.insert(RenderingPrepBuffCategory, ~[]);
|
||||||
(RenderingCategory, ~[]),
|
buckets.insert(RenderingCategory, ~[]);
|
||||||
];
|
|
||||||
|
|
||||||
ProfilerCategory::check_order(&buckets);
|
|
||||||
buckets
|
buckets
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the order of the buckets matches the order of the enum categories
|
|
||||||
fn check_order(vec: &ProfilerBuckets) {
|
|
||||||
for &(category, _) in vec.iter() {
|
|
||||||
if category != vec[category as uint].first() {
|
|
||||||
fail!("Enum category does not match bucket index. This is a bug.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// some categories are subcategories of LayoutPerformCategory
|
// some categories are subcategories of LayoutPerformCategory
|
||||||
// and should be printed to indicate this
|
// and should be printed to indicate this
|
||||||
pub fn format(self) -> ~str {
|
pub fn format(self) -> ~str {
|
||||||
|
@ -112,6 +91,15 @@ impl ProfilerCategory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProfilerBuckets = TreeMap<ProfilerCategory, ~[float]>;
|
||||||
|
|
||||||
|
// back end of the profiler that handles data aggregation and performance metrics
|
||||||
|
pub struct Profiler {
|
||||||
|
port: Port<ProfilerMsg>,
|
||||||
|
buckets: ProfilerBuckets,
|
||||||
|
last_msg: Option<ProfilerMsg>,
|
||||||
|
}
|
||||||
|
|
||||||
impl Profiler {
|
impl Profiler {
|
||||||
pub fn create(port: Port<ProfilerMsg>) {
|
pub fn create(port: Port<ProfilerMsg>) {
|
||||||
let port = Cell::new(port);
|
let port = Cell::new(port);
|
||||||
|
@ -141,14 +129,11 @@ impl Profiler {
|
||||||
|
|
||||||
fn handle_msg(&mut self, msg: ProfilerMsg) {
|
fn handle_msg(&mut self, msg: ProfilerMsg) {
|
||||||
match msg {
|
match msg {
|
||||||
TimeMsg(category, t) => match self.buckets[category as uint] {
|
TimeMsg(category, t) => self.buckets.find_mut(&category).unwrap().push(t),
|
||||||
//TODO(tkuehn): would be nice to have tuple.second_mut()
|
|
||||||
(_, ref mut data) => data.push(t),
|
|
||||||
},
|
|
||||||
PrintMsg => match self.last_msg {
|
PrintMsg => match self.last_msg {
|
||||||
// only print if more data has arrived since the last printout
|
// only print if more data has arrived since the last printout
|
||||||
Some(TimeMsg(*)) => self.print_buckets(),
|
Some(TimeMsg(*)) => self.print_buckets(),
|
||||||
_ => {}
|
_ => ()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.last_msg = Some(msg);
|
self.last_msg = Some(msg);
|
||||||
|
@ -158,11 +143,10 @@ impl Profiler {
|
||||||
println(fmt!("%31s %15s %15s %15s %15s %15s",
|
println(fmt!("%31s %15s %15s %15s %15s %15s",
|
||||||
"_category_", "_mean (ms)_", "_median (ms)_",
|
"_category_", "_mean (ms)_", "_median (ms)_",
|
||||||
"_min (ms)_", "_max (ms)_", "_bucket size_"));
|
"_min (ms)_", "_max (ms)_", "_bucket size_"));
|
||||||
for bucket in self.buckets.mut_iter() {
|
for (category, data) in self.buckets.iter() {
|
||||||
let (category, data) = match *bucket {
|
// FIXME(XXX): TreeMap currently lacks mut_iter()
|
||||||
(category, ref mut data) => (category, data),
|
let mut data = data.clone();
|
||||||
};
|
tim_sort(data);
|
||||||
tim_sort(*data);
|
|
||||||
let data_len = data.len();
|
let data_len = data.len();
|
||||||
if data_len > 0 {
|
if data_len > 0 {
|
||||||
let (mean, median, &min, &max) =
|
let (mean, median, &min, &max) =
|
||||||
|
@ -202,4 +186,12 @@ pub fn time<T>(msg: &str, callback: &fn() -> T) -> T{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
// ensure that the order of the buckets matches the order of the enum categories
|
||||||
|
#[test]
|
||||||
|
fn check_order() {
|
||||||
|
let buckets = ProfilerCategory::empty_buckets();
|
||||||
|
assert!(buckets.len() == NumBuckets as uint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1
src/support/http/rust-http
Submodule
1
src/support/http/rust-http
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 2304f5e028c231de456393239e43068c5001317f
|
|
@ -5,6 +5,6 @@
|
||||||
|
|
||||||
#larger2 {
|
#larger2 {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
line-height: 1;
|
line-height: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Regular font <span id="larger1">Even larger with line-height 2</span></div>
|
<div>Regular font <span id="larger1">Even larger with line-height 2</span></div>
|
||||||
<div id="larger2">Large line 2!</div>
|
<div id="larger2">line-height 3!</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
13
src/test/html/test-lineheight-verticalalign.html
Normal file
13
src/test/html/test-lineheight-verticalalign.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="line-height: 10;">[line-height 10]
|
||||||
|
<span style="font-size: 15pt; line-height: 3; vertical-align: top">[line-height:3 + vertical-align:top]</span>
|
||||||
|
<span style="font-size: 15pt; line-height: 1; vertical-align: top">[line-height:1 + vertical-align:top]</span>
|
||||||
|
[Split inline, still line-height 5]
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 30px; line-height: 3">New line, line-height 3</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
src/test/html/vertical_align_simple.html
Normal file
24
src/test/html/vertical_align_simple.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
[test1] <b style="font-size:20px">baseline</b><img src="test.jpeg"></img>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
[test2] <b style="font-size:20px; vertical-align:top">vertical-align:top</b><img src="test.jpeg"></img>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
[test3] <b style="font-size:20px; vertical-align:middle">vertical-align:middle</b><img src="test.jpeg"></img>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
[test4] <b style="font-size:20px; vertical-align:bottom">vertical-align:bottom</b><img src="test.jpeg"></img>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
[test5] <b style="font-size:20px;">img=>text-top</b><img src="test.jpeg" style="vertical-align: text-top;"></img>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
[test6] <b style="font-size:20px;">img=>text-bottom</b><img src="test.jpeg" style="vertical-align: text-bottom;"></img>
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue