Skip to content

Commit

Permalink
Merge 0e1b79c into 91e9853
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Oct 29, 2018
2 parents 91e9853 + 0e1b79c commit 1bd6be4
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 55 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Azul features multiple ways of preventing your UI from being blocked, such as

When programming reusable and common UI elements, such as lists, tables or sliders
you don't want the user having to write code to update the UI state of these widgets.
Previously, this could only be solved by inheritance, but due to Azuls unique
Previously, this could only be solved by inheritance, but due to Azul's unique
architecture, it is possible to create widgets that update themselves purely by
composition, for example:

Expand Down Expand Up @@ -187,7 +187,7 @@ positioning), hit-testing texts, caching and an (optional) SVG parsing module.
While Azul can't help you (yet) with 3D content, it does provide easy ways to hook
into the OpenGL context of the running application - you can draw everything you
want to an OpenGL texture, which will then be composited into the frame using
webrender.
WebRender.

[Read more about OpenGL drawing ...](https://github.com/maps4print/azul/wiki/OpenGL-drawing)

Expand Down Expand Up @@ -231,7 +231,7 @@ extremely low memory requirements.
Several projects have helped severely during the development and should be credited:

- Chris Tollidays [limn](https://github.com/christolliday/limn) framework has helped
a lot with discovering undocumented parts of webrender.
a lot with discovering undocumented parts of WebRender.
- Nicolas Silva for his work on [lyon](https://github.com/nical/lyon) - without this,
the SVG renderer wouldn't have been possible

Expand Down
7 changes: 4 additions & 3 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//!
//! Changes in the DOM can happen in three ways:
//!
//! - An element changes its content An element is pushed as a child The order / childs of an element
//! - are restructured
//! - An element changes its content
//! - An element is pushed as a child
//! - The order / children of an element are restructured
//!
//! In order for the caching to be effective, we need to solve the problem of only adding
//! EditVariable-s if needed. In order to do that, we need two elements for each DOM node:
Expand Down Expand Up @@ -115,7 +116,7 @@ impl DomTreeCache {
changeset.added_nodes.insert(NodeId::new(next_idx), next_hash.data);
}
} else {
// println!("chrildren: no old hash, but subtree has to be added: {:?}!", new_next_id);
// println!("children: no old hash, but subtree has to be added: {:?}!", new_next_id);
changeset.added_nodes.insert(NodeId::new(next_idx), next_hash.data);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn new_opengl_texture_id() -> usize {

lazy_static! {
/// Non-cleaned up textures. When a GlTexture is registered, it has to stay active as long
/// as webrender needs it for drawing. To transparently do this, we store the epoch that the
/// as WebRender needs it for drawing. To transparently do this, we store the epoch that the
/// texture was originally created with, and check, **after we have drawn the frame**,
/// if there are any textures that need cleanup.
///
Expand Down Expand Up @@ -66,7 +66,7 @@ impl ExternalImageHandler for Compositor {
let gl_tex_lock = ACTIVE_GL_TEXTURES.lock().unwrap();

// Search all epoch hash maps for the given key
// There does not seemt to be a way to get the epoch for the key,
// There does not seem to be a way to get the epoch for the key,
// so we simply have to search all active epochs
//
// NOTE: Invalid textures can be generated on minimize / maximize
Expand Down
4 changes: 2 additions & 2 deletions src/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ pub(crate) fn match_dom_css_selectors<T: Layout>(
}

UiDescription {
// note: this clone is neccessary, otherwise,
// note: this clone is necessary, otherwise,
// we wouldn't be able to update the UiState
//
// WARNING: The UIState can modify the `arena` with its copy of the Rc !
Expand Down Expand Up @@ -858,4 +858,4 @@ fn test_detect_static_or_dynamic_property() {
determine_static_or_dynamic_css_property("text-align", "[[ | ]]"),
Err(DynamicCssParseError::EmptyBraces)
);
}
}
16 changes: 8 additions & 8 deletions src/css_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ pub use {
use webrender::api::{BorderStyle, BorderRadius, BorderSide, LayoutRect};

pub(crate) const EM_HEIGHT: f32 = 16.0;
/// Webrender measures in points, not in pixels!
/// WebRender measures in points, not in pixels!
pub(crate) const PT_TO_PX: f32 = 96.0 / 72.0;

// In case no font size is specified for a node,
// this will be subsituted as the default font size
// this will be substituted as the default font size
pub(crate) const DEFAULT_FONT_SIZE: StyleFontSize = StyleFontSize(PixelValue {
metric: CssMetric::Px,
number: 10_000,
Expand Down Expand Up @@ -1514,8 +1514,8 @@ impl Direction {
let width_half = rect.size.width as usize / 2;
let height_half = rect.size.height as usize / 2;

// hypothenuse_len is the length of the center of the rect to the corners
let hypothenuse_len = (((width_half * width_half) + (height_half * height_half)) as f64).sqrt();
// hypotenuse_len is the length of the center of the rect to the corners
let hypotenuse_len = (((width_half * width_half) + (height_half * height_half)) as f64).sqrt();

// clamp the degree to 360 (so 410deg = 50deg)
let mut deg = deg % 360.0;
Expand Down Expand Up @@ -1552,7 +1552,7 @@ impl Direction {

// Searched_len is the distance between the center of the rect and the
// ending point of the gradient
let searched_len = (hypothenuse_len * degree_diff_to_corner.to_radians().cos()).abs();
let searched_len = (hypotenuse_len * degree_diff_to_corner.to_radians().cos()).abs();

// TODO: This searched_len is incorrect...

Expand Down Expand Up @@ -2543,7 +2543,7 @@ multi_type_parser!(parse_layout_text_align, StyleTextAlignmentHorz,
/// CssColor is simply a wrapper around the internal CSS color parsing methods.
///
/// Sometimes you'd want to load and parse a CSS color, but you don't want to
/// write your own parser for that. Since azul already has a parser for CSS colors,
/// write your own parser for that. Since Azul already has a parser for CSS colors,
/// this API exposes
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct CssColor {
Expand Down Expand Up @@ -2571,7 +2571,7 @@ impl CssColor {

/// If `prefix_hash` is set to false, you only get the string, without a hash, in lowercase
///
/// If `self.alpha` is `FF`, it wil be omitted from the final result (since `FF` is the default for CSS colors)
/// If `self.alpha` is `FF`, it will be omitted from the final result (since `FF` is the default for CSS colors)
pub fn to_string(&self, prefix_hash: bool) -> String {
let prefix = if prefix_hash { "#" } else { "" };
let alpha = if self.internal.a == 255 { String::new() } else { format!("{:02x}", self.internal.a) };
Expand Down Expand Up @@ -3028,4 +3028,4 @@ mod css_tests {
left: Some(PixelValue::px(100.0)),
}));
}
}
}
6 changes: 3 additions & 3 deletions src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<T> Daemon<T> {
app_resources: &mut AppResources)
-> (UpdateScreen, TerminateDaemon)
{
// Check if the deamons timeout is reached
// Check if the daemons timeout is reached
if let Some(max_timeout) = self.max_timeout {
if Instant::now() - self.created > max_timeout {
return (UpdateScreen::DontRedraw, TerminateDaemon::Terminate);
Expand All @@ -147,7 +147,7 @@ impl<T> Daemon<T> {
}
}

// #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] for Deamon<T>
// #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] for Daemon<T>

impl<T> fmt::Debug for Daemon<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -205,4 +205,4 @@ impl<T> PartialEq for Daemon<T> {

impl<T> Eq for Daemon<T> { }

impl<T> Copy for Daemon<T> { }
impl<T> Copy for Daemon<T> { }
4 changes: 2 additions & 2 deletions src/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<'a, T: Layout + 'a> fmt::Debug for DisplayList<'a, T> {
pub(crate) struct DisplayRectangle<'a> {
/// `Some(id)` if this rectangle has a callback attached to it
/// Note: this is not the same as the `NodeId`!
/// These two are completely seperate numbers!
/// These two are completely separate numbers!
pub tag: Option<u64>,
/// The original styled node
pub(crate) styled_node: &'a StyledNode,
Expand Down Expand Up @@ -781,7 +781,7 @@ struct DisplayListParametersMut<'a, T: 'a + Layout> {
/// The app resources, so that a sub-DOM / iframe can register fonts and images
/// TODO: How to handle cleanup ???
pub app_resources: &'a mut AppResources,
/// If new fonts or other stuff are created, we need to tell webrender about this
/// If new fonts or other stuff are created, we need to tell WebRender about this
pub resource_updates: &'a mut Vec<ResourceUpdate>,
/// Window access, so that sub-items can register OpenGL textures
pub fake_window: &'a mut FakeWindow<T>,
Expand Down
8 changes: 4 additions & 4 deletions src/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ pub enum NodeType<T: Layout> {
Label(String),
/// Larger amount of text, that has to be cached
Text(TextId),
/// An image that is rendered by webrender. The id is aquired by the
/// An image that is rendered by WebRender. The id is acquired by the
/// `AppState::add_image()` function
Image(ImageId),
/// OpenGL texture. The `Svg` widget deserizalizes itself into a texture
/// Equality and Hash values are only checked by the OpenGl texture ID,
/// azul does not check that the contents of two textures are the same
/// Azul does not check that the contents of two textures are the same
GlTexture((GlTextureCallback<T>, StackCheckedPointer<T>)),
/// DOM that gets passed its width / height during the layout
IFrame((IFrameCallback<T>, StackCheckedPointer<T>)),
Expand Down Expand Up @@ -875,7 +875,7 @@ impl<T: Layout> Dom<T> {
/// OpenGL texture, use `ReadOnlyWindow::create_texture` to create a texture
///
/// **WARNING**: Don't forget to call `ReadOnlyWindow::unbind_framebuffer()`
/// when you are done with your OpenGL drawing, otherwise webrender will render
/// when you are done with your OpenGL drawing, otherwise WebRender will render
/// to the texture, not the window, so your texture will actually never show up.
/// If you use a `Texture` and you get a blank screen, this is probably why.
#[derive(Debug, Clone)]
Expand All @@ -895,7 +895,7 @@ impl Texture {
/// OpenGL drivers point of view.
///
/// **WARNING**: Don't forget to call `ReadOnlyWindow::unbind_framebuffer()`
/// when you are done with your OpenGL drawing, otherwise webrender will render
/// when you are done with your OpenGL drawing, otherwise WebRender will render
/// to the texture instead of the window, so your texture will actually
/// never show up on the screen, since it is never rendered.
/// If you use a `Texture` and you get a blank screen, this is probably why.
Expand Down
2 changes: 1 addition & 1 deletion src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub(crate) enum FontState {
// Font is available for the renderer
Uploaded(FontKey),
// Raw bytes for the font, to be uploaded in the next
// draw call (for webrenders add_raw_font function)
// draw call (for WebRender's add_raw_font function)
ReadyForUpload(Vec<u8>),
/// Font that is about to be deleted
/// We need both the ID (to delete the bytes of the font)
Expand Down
12 changes: 6 additions & 6 deletions src/id_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ mod node_id {

impl NodeId {
/// **NOTE**: In debug mode, it panics on overflow, since having a
/// pointer that is zero is undefined behaviour (it would bascially be
/// casted to a `None`), which is incorrect, so we rather panic on overflow
/// pointer that is zero is undefined behaviour (it would basically be
/// cast to a `None`), which is incorrect, so we rather panic on overflow
/// to prevent that.
///
/// To trigger an overflow however, you'd need more that 4 billion DOM nodes -
Expand Down Expand Up @@ -554,7 +554,7 @@ macro_rules! impl_node_iterator {
}
}

/// An linear iterator, does not respec the DOM in any way,
/// An linear iterator, does not respect the DOM in any way,
/// it just iterates over the nodes like a Vec
#[derive(Debug, Copy, Clone)]
pub struct LinearIterator {
Expand Down Expand Up @@ -687,7 +687,7 @@ impl<'a, T> Iterator for Traverse<'a, T> {

// `node.parent()` here can only be `None`
// if the tree has been modified during iteration,
// but silently stoping iteration
// but silently stopping iteration
// seems a more sensible behavior than panicking.
None => None
}
Expand Down Expand Up @@ -733,7 +733,7 @@ impl<'a, T> Iterator for ReverseTraverse<'a, T> {

// `node.parent()` here can only be `None`
// if the tree has been modified during iteration,
// but silently stoping iteration
// but silently stopping iteration
// seems a more sensible behavior than panicking.
None => None
}
Expand Down Expand Up @@ -818,4 +818,4 @@ mod id_tree_tests {
assert_eq!(children, vec!["a", "b", "c"]);
assert_eq!(reverse_children, vec!["c", "b", "a"]);
}
}
}
2 changes: 1 addition & 1 deletion src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Task<T> {
// Task is in progress
join_handle: Option<JoinHandle<()>>,
dropcheck: Weak<()>,
/// Deamons that run directly after completion of this task
/// Daemons that run directly after completion of this task
pub(crate) after_completion_daemons: Vec<Daemon<T>>
}

Expand Down
12 changes: 6 additions & 6 deletions src/text_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl TextSizePx {
///
/// This is important for calculating metrics such as the minimal
/// bounding box of a block of text, for example - without actually
/// acessing the font at all.
/// accessing the font at all.
///
/// Be careful when caching this - the `Words` are independent of the
/// original font, so be sure to note the font ID if you cache this struct.
Expand Down Expand Up @@ -263,7 +263,7 @@ pub struct FontMetrics {
/// - `font_size`: The font size (without line height)
/// - `text_layout_options`: Contains options for text layout, such as letter spacing, line height +
/// horizontal and vertical alignment
/// - `text`: The actual text to layout. Will be unicode-normalized after the Unicode Normalization Form C
/// - `text`: The actual text to layout. Will be Unicode-normalized after the Unicode Normalization Form C
/// (canonical decomposition followed by canonical composition).
/// - `overflow`: If the scrollbars should be show, parsed from the `overflow-{x / y}` fields
/// - `scrollbar_info`: Mostly used to reserve space for the scrollbar, if necessary.
Expand Down Expand Up @@ -779,7 +779,7 @@ fn words_to_left_aligned_glyphs<'a>(
NoMaxWidth(f32),
}

// The line break offsets (neded for center- / right-aligned text contains:
// The line break offsets (needed for center- / right-aligned text contains:
//
// - The index of the glyph at which the line breaks
// - How much space each line has (to the right edge of the containing rectangle)
Expand Down Expand Up @@ -845,7 +845,7 @@ fn words_to_left_aligned_glyphs<'a>(
word_caret += tab_width.0 + letter_spacing;
},
Return => {
// TODO: dupliated code
// TODO: duplicated code
let space_until_horz_return = match max_horizontal_width {
Some(s) => WordCaretMax::SomeMaxWidth(s - word_caret),
None => WordCaretMax::NoMaxWidth(word_caret),
Expand Down Expand Up @@ -1067,7 +1067,7 @@ pub fn layout_text<'a>(
-> LayoutTextResult
{
// NOTE: This function is different from the get_glyphs function that is
// used internally to azul.
// used internally to Azul.
//
// This function simply lays out a text, without trying to fit it into a rectangle.
// This function does not calculate any overflow.
Expand Down Expand Up @@ -1101,4 +1101,4 @@ fn test_it_should_add_origin() {
assert_eq!(instances[0].point.y as usize, 0);
assert_eq!(instances[1].point.x as usize, 33);
assert_eq!(instances[1].point.y as usize, 10);
}
}
8 changes: 4 additions & 4 deletions src/ui_solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl Arena<$struct_name> {

use self::WhConstraint::*;

// Sum of the direct childrens flex-basis = the parents preferred width
// Sum of the direct children's flex-basis = the parents preferred width
let children_flex_basis = self.sum_children_flex_basis(*non_leaf_id, arena);

// Calculate the new flex-basis width
Expand Down Expand Up @@ -358,7 +358,7 @@ impl Arena<$struct_name> {
// Now we can be sure that if we write #x { width: 500px; } that it will actually be 500px large
// and not be influenced by flex in any way.

// 2. Set all items to their minimium width. Record how much space is gained by doing so.
// 2. Set all items to their minimum width. Record how much space is gained by doing so.
let mut horizontal_space_taken_up_by_variable_items = 0.0;

use FastHashSet;
Expand Down Expand Up @@ -430,7 +430,7 @@ impl Arena<$struct_name> {
}

// This satisfies the `width` and `min_width` constraints. However, we still need to worry about
// the `max_width` and unconstrained childs
// the `max_width` and unconstrained children.
//
// By setting the items to their minimum size, we've gained some space that we now need to distribute
// according to the flex_grow values
Expand Down Expand Up @@ -1309,4 +1309,4 @@ mod layout_tests {
space_added: window_width - 200.0,
});
}
}
}
Loading

0 comments on commit 1bd6be4

Please sign in to comment.