mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Auto merge of #14644 - servo:ever-so-slightly-less-unstable, r=heycam
Ever so slightly less unstable <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14644) <!-- Reviewable:end -->
This commit is contained in:
commit
e13f001793
10 changed files with 16 additions and 27 deletions
|
@ -5,7 +5,7 @@
|
|||
use immeta::load_from_buf;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use net_traits::{CoreResourceThread, NetworkError, fetch_async, FetchResponseMsg, FetchMetadata, Metadata};
|
||||
use net_traits::{CoreResourceThread, NetworkError, fetch_async, FetchResponseMsg};
|
||||
use net_traits::image::base::{Image, ImageMetadata, PixelFormat, load_from_memory};
|
||||
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheCommand, ImageCacheThread, ImageState};
|
||||
use net_traits::image_cache_thread::{ImageCacheResult, ImageOrMetadataAvailable, ImageResponse, UsePlaceholder};
|
||||
|
|
|
@ -4260,7 +4260,9 @@ class CGUnionConversionStruct(CGThing):
|
|||
|
||||
return CGWrapper(
|
||||
CGIndenter(jsConversion, 4),
|
||||
pre="unsafe fn TryConvertTo%s(cx: *mut JSContext, value: HandleValue) -> %s {\n" % (t.name, returnType),
|
||||
# TryConvertToObject is unused, but not generating it while generating others is tricky.
|
||||
pre="#[allow(dead_code)] unsafe fn TryConvertTo%s(cx: *mut JSContext, value: HandleValue) -> %s {\n"
|
||||
% (t.name, returnType),
|
||||
post="\n}")
|
||||
|
||||
def define(self):
|
||||
|
|
|
@ -437,6 +437,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-media-load-algorithm
|
||||
#[allow(unreachable_code)]
|
||||
fn resource_selection_algorithm_sync(&self, base_url: ServoUrl) {
|
||||
// TODO step 5 (populate pending text tracks)
|
||||
|
||||
|
@ -446,7 +447,7 @@ impl HTMLMediaElement {
|
|||
ResourceSelectionMode::Object
|
||||
} else if let Some(attr) = self.upcast::<Element>().get_attribute(&ns!(), &local_name!("src")) {
|
||||
ResourceSelectionMode::Attribute(attr.Value().to_string())
|
||||
} else if false {
|
||||
} else if false { // TODO: when implementing this remove #[allow(unreachable_code)] above.
|
||||
// TODO <source> child
|
||||
ResourceSelectionMode::Children(panic!())
|
||||
} else {
|
||||
|
|
|
@ -69,7 +69,7 @@ macro_rules! declare_viewport_descriptor_inner {
|
|||
const VIEWPORT_DESCRIPTOR_VARIANTS: usize = $number_of_variants;
|
||||
|
||||
impl ViewportDescriptor {
|
||||
fn discriminant_value(&self) -> usize {
|
||||
pub fn discriminant_value(&self) -> usize {
|
||||
match *self {
|
||||
$(
|
||||
ViewportDescriptor::$assigned_variant(..) => $assigned_discriminant,
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#![feature(core_intrinsics)]
|
||||
#![feature(link_args)]
|
||||
#![feature(plugin)]
|
||||
#![feature(unicode)]
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
|
@ -22,7 +21,6 @@ extern crate euclid;
|
|||
extern crate gfx_traits;
|
||||
extern crate gleam;
|
||||
extern crate glutin_app;
|
||||
extern crate rustc_unicode;
|
||||
extern crate script_traits;
|
||||
extern crate servo_config;
|
||||
extern crate servo_geometry;
|
||||
|
|
|
@ -7,8 +7,6 @@ use std::slice;
|
|||
use string::cef_string_utf16_set;
|
||||
use types::{cef_string_list_t,cef_string_t};
|
||||
|
||||
use rustc_unicode::str::Utf16Encoder;
|
||||
|
||||
//cef_string_list
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -38,7 +36,7 @@ pub extern "C" fn cef_string_list_value(lt: *mut cef_string_list_t, index: c_int
|
|||
if index < 0 || lt.is_null() { return 0; }
|
||||
if index as usize > (*lt).len() - 1 { return 0; }
|
||||
let ref string = (*lt)[index as usize];
|
||||
let utf16_chars: Vec<u16> = Utf16Encoder::new(string.chars()).collect();
|
||||
let utf16_chars: Vec<u16> = string.encode_utf16().collect();
|
||||
cef_string_utf16_set(utf16_chars.as_ptr(), utf16_chars.len(), value, 1)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ use eutil::Downcast;
|
|||
use interfaces::CefApp;
|
||||
use interfaces::CefBrowser;
|
||||
use render_handler::CefRenderHandlerExtensions;
|
||||
use rustc_unicode::str::Utf16Encoder;
|
||||
use types::{cef_cursor_handle_t, cef_cursor_type_t, cef_rect_t};
|
||||
use wrappers::CefWrap;
|
||||
|
||||
|
@ -331,10 +330,7 @@ impl WindowMethods for Window {
|
|||
Some(ref browser) => browser,
|
||||
};
|
||||
let str = match info {
|
||||
Some(s) => {
|
||||
let utf16_chars: Vec<u16> = Utf16Encoder::new(s.chars()).collect();
|
||||
utf16_chars
|
||||
}
|
||||
Some(s) => s.encode_utf16().collect::<Vec<u16>>(),
|
||||
None => vec![]
|
||||
};
|
||||
|
||||
|
@ -397,7 +393,7 @@ impl WindowMethods for Window {
|
|||
};
|
||||
if check_ptr_exist!(browser.get_host().get_client(), get_load_handler) &&
|
||||
check_ptr_exist!(browser.get_host().get_client().get_load_handler(), on_load_error) {
|
||||
let utf16_chars: Vec<u16> = Utf16Encoder::new((url).chars()).collect();
|
||||
let utf16_chars: Vec<u16> = url.encode_utf16().collect();
|
||||
browser.get_host()
|
||||
.get_client()
|
||||
.get_load_handler()
|
||||
|
@ -428,10 +424,7 @@ impl WindowMethods for Window {
|
|||
let frame = frame.downcast();
|
||||
let mut title_visitor = frame.title_visitor.borrow_mut();
|
||||
let str = match string {
|
||||
Some(s) => {
|
||||
let utf16_chars: Vec<u16> = Utf16Encoder::new(s.chars()).collect();
|
||||
utf16_chars
|
||||
}
|
||||
Some(s) => s.encode_utf16().collect(),
|
||||
None => vec![]
|
||||
};
|
||||
|
||||
|
@ -461,7 +454,7 @@ impl WindowMethods for Window {
|
|||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let mut frame_url = servoframe.url.borrow_mut();
|
||||
*frame_url = url.into_string();
|
||||
let utf16_chars: Vec<u16> = Utf16Encoder::new((*frame_url).chars()).collect();
|
||||
let utf16_chars: Vec<u16> = frame_url.encode_utf16().collect();
|
||||
if check_ptr_exist!(browser.get_host().get_client(), get_display_handler) &&
|
||||
check_ptr_exist!(browser.get_host().get_client().get_display_handler(), on_address_change) {
|
||||
browser.get_host().get_client().get_display_handler().on_address_change((*browser).clone(), frame.clone(), utf16_chars.as_slice());
|
||||
|
|
|
@ -8,7 +8,6 @@ use interfaces::{cef_dialog_handler_t, cef_focus_handler_t};
|
|||
use interfaces::{cef_download_handler_t, cef_drag_handler_t, cef_context_menu_handler_t};
|
||||
use interfaces::{cef_geolocation_handler_t, cef_jsdialog_handler_t, cef_keyboard_handler_t};
|
||||
use interfaces::{cef_load_handler_t, cef_request_handler_t};
|
||||
use rustc_unicode::str::Utf16Encoder;
|
||||
use types::{cef_base_t, cef_browser_settings_t, CefBrowserSettings, cef_color_model_t};
|
||||
use types::{cef_context_menu_edit_state_flags_t};
|
||||
use types::{cef_context_menu_media_state_flags_t};
|
||||
|
@ -255,7 +254,7 @@ impl<'a,'b> CefWrap<*mut *const c_char> for &'a mut &'b str {
|
|||
|
||||
impl<'a> CefWrap<cef_string_userfree_t> for String {
|
||||
fn to_c(string: String) -> cef_string_userfree_t {
|
||||
let utf16_chars: Vec<u16> = Utf16Encoder::new(string.chars()).collect();
|
||||
let utf16_chars: Vec<u16> = string.encode_utf16().collect();
|
||||
|
||||
let boxed_string;
|
||||
unsafe {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![cfg(test)]
|
||||
#![feature(core_intrinsics, plugin, test)]
|
||||
#![feature(plugin, test)]
|
||||
|
||||
extern crate app_units;
|
||||
extern crate cssparser;
|
||||
|
|
|
@ -51,13 +51,11 @@ fn test_meta_viewport<F>(meta: &str, callback: F)
|
|||
where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str)
|
||||
{
|
||||
if let Some(mut rule) = ViewportRule::from_meta(meta) {
|
||||
use std::intrinsics::discriminant_value;
|
||||
|
||||
// from_meta uses a hash-map to collect the declarations, so we need to
|
||||
// sort them in a stable order for the tests
|
||||
rule.declarations.sort_by(|a, b| {
|
||||
let a = unsafe { discriminant_value(&a.descriptor) };
|
||||
let b = unsafe { discriminant_value(&b.descriptor) };
|
||||
let a = a.descriptor.discriminant_value();
|
||||
let b = b.descriptor.discriminant_value();
|
||||
a.cmp(&b)
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue